PHP and ...

Started by wilnix, March 04, 2002, 03:44:16 PM

Previous topic - Next topic
I've found that PHP4 mixed with these tools is so powerful for webservers running apache:

openssl - http://www.openssl.org
mod_ssl - http://www.modssl.org
MySQL - http://www.mysql.org
pdflib - http://www.pdflib.com/pdflib/index.html
cURL - http://curl.haxx.se


Documentation for these can be found all over the net.

Good Luck!

Wilnix
alt email address: wilnix@hackphreak.org

Yup, PHP and MySQL seems to be gaining lots of popularity for running custom message boards and various statistic compiling tools for webpages.

Can't be arsed trying to learn any of it though - I have enough on my plate as it is - I'll stick to graphics as far as web stuff goes!

I'll start posting some helpful tips this week...

Wilnix
alt email address: wilnix@hackphreak.org

The problem is that PHP5 doens't automatically come with MySQL as primary Database, so you get abit screwed over with that, where as PHP4 does but it has the worst OOP you'll see (well second worst, C++ is the worst OOP).

I'm okay with MySQL not being tied to PHP5. PostgreSQL is better in the long run anyways...


As far as OOP goes, well....There are better langs out there for this..


Wilnix
alt email address: wilnix@hackphreak.org

Ok Wilnix, my brain is officially mush. I decided I better get on the PHP bandwagon so I've basically went through a whole PHP MySQL text between yesterday and today (thank god for an understanding boss!) So basically I'll probably start badgering you with questions in the near future!

Actually why don't I start now! What type of front-end do you prefer? I've been messing around with MySQL Admin and PHPMyAdmin as well. Any suggestions? Cheers....
Godaigo
All's fair in Love and Brewing.

Ok, I'm ready to burn all my PHP books at this point. I finally figured out that one of the problems that I've been having (My work buddy could run my code no problem, but I couldn't) has to do with PHP5 change to turning global variables off by default and subsituting statements like $_POST[var]; and $_SERVER.. whatever. So, not having time to dig into that I went and turned the global variables back on. Still I can't get anything to insert into the database. Arghhhh! I'll post the code below, but I have no idea if the syntax is right because I've changed it so many times. I'm clueless at this point.... After turning global variables on the print statement shows that the variables are passed successfully. However the insert statement always dies. I'm running this on a remotely hosted server and looking through the PHPMyAdmin interface every possible permission is turned on for the user. Suggestions?

<?php
      
   $username="tiny";
   $password="tiny";
   $database="usertry";
   $site="localhost";
   $num = mysql_insert_id();
   
   
   print "$Comfort, $Staff, $Resources, $Description, $Use, $Like, $Dislike";
   
   $trycon = mysql_connect($site,$username,$password);
   if ($trycon) echo "<p>Connected Successfully</p>";
   else echo "<p>No luck connecting</p>";
   
   $trysec = mysql_select_db($database);
   if ($trysec) echo "<p>Database selected ok</p>";
   else echo "<p>No luck selecting db</p>";
      
      
   $query = "INSERT INTO survey VALUES('$Comfort','$Staff','$Resources','$Description','$Use','$Like', '$Dislike')";
   
   $result = mysql_query($query);
   
   if ($result) echo "<p>Insert was successful</p>";
   else echo "<p>There was a problem</p>";
   
   
   mysql_close();
   
   
?>


Also the form seems like it should work, but maybe the problem is there, and yes it's incredibly simple (or so I thought) on purpose.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
   <title>Untitled</title>
</head>

<body>
<h4>User ID test</h4>
<form action="process1.php" method="post">

The library is comfortable, clean, well-lit place.<br><br>
   <input type="radio" value="Strongly Agree" name="Comfort" />Strongly Agree<br>
   <input type="radio" value="Agree" name="Comfort" />Agree<br>
   <input type="radio" value="No Opinion" name="Comfort" />No Opinion<br>
   <input type="radio" value="Disagree" name="Comfort" />Disagree<br><br>
The library staff are friendly, helpful, and courteous.<br><br>
   <input type="radio" value="Strongly Agree" name="Staff" />Strongly Agree<br>
   <input type="radio" value="Agree" name="Staff" />Agree<br>
   <input type="radio" value="No Opinion" name="Staff" />No Opinion<br>
   <input type="radio" value="Disagree" name="Staff" />Disagree<br><br>
The library provides well-arranged resources, with clear directions on finding and using them.<br><br>
   <input type="radio" value="Strongly Agree" name="Resources" />Strongly Agree<br>
   <input type="radio" value="Agree" name="Resources" />Agree<br>
   <input type="radio" value="No Opinion" name="Resources" />No Opinion<br>
   <input type="radio" value="Disagree" name="Resources" />Disagree<br><br>
What best describes you?<br><br>
   <input type="radio" value="Frequent library patron" name="Description" />Frequent library patron<br>
   <input type="radio" value="Occasional library patron" name="Description" />Occasional library patron<br>
   <input type="radio" value="Infrequent library patron" name="Description" />Infrequent library patron<br><br>
Which library do you use?(Select all that apply)<br><br>
   <input type="radio" value="Douglas" name="Use" />Douglas<br>
   <input type="radio" value="Downtown" name="Use" />Downtown<br>
   <input type="radio" value="Mendenhall Valley" name="Use" />Mendenhall Valley<br>
   <input type="radio" value="JPL Web-based Services" name="Use" />JPL Web-based Services<br><br>
What do you like about the library?
   <br><TEXTAREA NAME="Like" ></TEXTAREA>
   
   <br><br>
What would you change about the library?
   <br> <TEXTAREA NAME="Dislike" ></TEXTAREA><br><br>
<input type="submit" >
</form>


</body>
</html>


Cheers....
Godaigo
All's fair in Love and Brewing.

Firstly.. I don't know sql (any variation) or php, so I don't know if this helps or not.. but here's a try.

I looked at this page:

http://us2.php.net/manual/en/function.mysql-query.php

and if I read it right, it shows that the mysql_query function can fetch the server's error message.  Have you tried actually printing the result of it, not just it failed or succeeded ?  Or if you have already tried it, what was the error message ?

I would start there, because then you can figure out (or more likely to) why it's failing. Then you can go from there.

And have you googled for 'mysql and php' ? It seems there is lots of info on it, though perhaps not on your issue itself. But if you can get the error message, maybe someone can help more... (if they don't already see the problem, since I obviously can't)
"My Terminal is my Soul"

Yeah, actually the remote hosting service (for some f*@%ing reason) blocks the standard error calls. It just doesn't return anything. Go figure. From what I can tell, I've been checking code examples for about a week, it should work. But I don't know if there is something about it that won't work with PHP5 (I turned global variables back on). I'm just stumped. A week of playing with the code and research and I have nothing. I was kinda hoping that it would be something glaringly obvious, but maybe its just something with the hosting service. But please, by all means, anyone who wants to try and run the code with PHP5, MySQL, and Apache give it a shot. Damn thing is enough to make me learn Ruby....
Godaigo
All's fair in Love and Brewing.

SMF spam blocked by CleanTalk