PHP 5 problem with issuing mysql commands from browser.
Posted: Mon Mar 29, 2004 4:11 pm
howdy gents,
I've hit a php roadblock--I've asked a few php-experienced friends and it has stumped them all.
I've got a php file that should insert given variables into a database (much like a guestbook script). When I run the file from an SSH client (replacing posted variables with internal ones, of course), it parses perfectly and modifies the database as desired. From a browser, however, it will not load anything after the mysql commands (it won't even die when the command fails).
Here is the code:
It echoes the first time but not the second.
(note: the mysql command was force installed rather than mysqli because the mysqli package was corrupt on the installer. I haven't yet tried to reinstall mysqli, mainly because the admin is out of town
)
Apache server, btw
cheers,
wyatt
I've hit a php roadblock--I've asked a few php-experienced friends and it has stumped them all.
I've got a php file that should insert given variables into a database (much like a guestbook script). When I run the file from an SSH client (replacing posted variables with internal ones, of course), it parses perfectly and modifies the database as desired. From a browser, however, it will not load anything after the mysql commands (it won't even die when the command fails).
Here is the code:
Code: Select all
<?php
error_reporting(E_ALL);
$data = "howdy";
$query = "INSERT INTO guests ";
$query .= "(guest_name)";
$query .= " values ('$data')";
echo "$query";
mysql_pconnect('localhost' , 'user' , 'password');
mysql_select_db("guestbook");
echo "$query";
mysql_query($query) or die ("Error: " . mysql_error());
?>(note: the mysql command was force installed rather than mysqli because the mysqli package was corrupt on the installer. I haven't yet tried to reinstall mysqli, mainly because the admin is out of town
Apache server, btw
cheers,
wyatt