We have faced strange issue with MySql old version (version 4).
Our php file will pass a querystring variable "id". It can have a value or it can be empty in some situation.
Initially, we used below code,
$id=$_GET['id'];
$sql="select school_name from school_table where id=$id";
$result=mysql_query($sql);
It was working fine if the $id is assinged with a value.
It showed syntax error if $id is not having any value.
Below workaround resolved the issue.
Added below code above the query.
if ($id=="")
{
$id="null";
}
More Articles...
Shop at Rajamanickam.com | Birthday Gift Idea? | Hire me for $6 per Hour
Get 3 useful ebooks for Rs 99 in India and $5.99 globally
Get a 75% commission | ChatGPT and and Google Gemini for Beginners (Use Discount code QPT)
Search This Blog
Art of Talking to AI | Tech eBook | Dream Big | Listen to Dream Big
Today's Deals | Timesheet | Products | 3 ebooks for $5.99 / Rs 99 | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
Today's Deals | Timesheet | Products | 3 ebooks for $5.99 / Rs 99 | Earn 50% commission
About | Privacy | Follow | TOS | WhatsApp | Contact
I may earn a commission from Amazon affiliate links
No comments:
Post a Comment