Jump to content

is it with php ??


doctor_james

Recommended Posts

Hi guys . I have a Mysql table But anytime I post some data using mysql_query() nothing happens . but when I change fields' names it works . have you guys had this problem ? I think it's not with mysql for I can insert data through phpmyadmin . it's a boring job to change fields' names frequently .

Link to comment
https://forums.phpfreaks.com/topic/70387-is-it-with-php/
Share on other sites

thanks for your answers .

I dont think they're reserved words since adding prefixes does not work ! Here's my code :

 

$query="INSERT INTO ent(user,title,cat,summary,entire,source,pdf,photo,date,time,comment,status) VALUES ('$user','$title','$cats','$summary','$entire','$source','{$pdf['name']}','{$photo['name']}','$date','$time','$comment','$status')";  

Link to comment
https://forums.phpfreaks.com/topic/70387-is-it-with-php/#findComment-353609
Share on other sites

A good way to take reserved words out of the equation is to escape your field names. I wrote a class that actually generates my query strings for me and does just this. Take notice of the backtick around field names. If you've ever used phpmyadmin you might have noticed that it does this too.

 

$query="INSERT INTO ent(`user`,`title`,`cat`,`summary`,`entire`,`source`,`pdf`,`photo`,`date`,`time`,`comment`,`status`) VALUES ('$user','$title','$cats','$summary','$entire','$source','{$pdf['name']}','{$photo['name']}','$date','$time','$comment','$status')";

Link to comment
https://forums.phpfreaks.com/topic/70387-is-it-with-php/#findComment-353638
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.