PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am still quite a newbie here. I am working on a very simple PHP/MySQL app to catalog my CDs. This is for a school project. Anyway, I am having a couple of problems with this that I haven't been able to figure out. I will post the first one here...
I am getting a PARSE ERROR UNEXPECTED ')' in LINE 14 when I try to use this add info to the database. Is there a better way that I should have done this? I tried commenting out that block, but then I get other errors.
My other problem with this project, and this has been the big one is...
I can't get the data to post to the database, nor can I even get an error or reason why it's not. The script should produce either "data has been added" or "try again", but it does nothing but put the title on the screen. When I manually check the DB with PHPMyAdmin, no data has been added to the tables. If I manually add data to the table, my search script does the same thing that my add script does, which is nothing. Not even the error. Is there anyway to force this to give some kind of error at least so I can see why it's not posting to the DB?
well, technically your insert should work, but you should create a primary key "ID" field. Also, you may want to Censor your real username and passwords when you post code
I'm not sure what the problem is. Try echoing $query after setting it.
//assume connection , etc....
$sql - "select * from this_table where my_value='$something'";
$Resource = mysql_query($sql);
echo mysql_error();
echo $sql;
It's always helpful to get mysql's error message- if there is none, then mysql didnt have an error, so then echoing $sql will show you what the actual query was, (maybe a variable or a typo causing teh value to be null?)