SQL statement in php

Source: Internet
Author: User
The SQL statement I spelled in php is an SQL statement in php.

Select * from 'zx _ solutions 'where s_id = 6?

Run this statement in the database and report the following error:
[SQL]
Select * from 'zx _ solutions 'where s_id = 6?

[Err] 1054-Unknown column '6? 'In' where clause'

Expert advice:


Reply to discussion (solution)

Select * from 'zx _ solutions 'where's _ id' = 6?
This way

@ #2. this won't work either. it regards 6 as a column.

Paste your code snippet
It is estimated that the space is incorrect.

Function getsolutionbyid ($ sid ){
$ SQL = "select * from zx_solutions where s_id = $ sid ";
Echo $ SQL;
$ Rs = $ this-> db-> query ($ SQL );
Return $ rs;
}

When I run the above code, an error is reported?
What database are you using, and what is the structure of the zx_solutions table. It is best to list all of them.

Try to enclose 6 with quotation marks?

6. do not have spaces on the front.

If you try another tool, it may be a problem with mysql.

Practical

Are you sure you want to use the 'zx _ solution' symbol?


Select * from 'table name' where field name = '6'

It may be a wrong symbol.

Select * from 'zx _ solutions 'Where's _ id' = '6 '?

Check whether the database and data table are connected successfully, and then check whether the queried value is incorrectly formatted.

????

function getsolutionbyid($sid) {  $sql = "select * from zx_solutions where s_id =".intval($sid);  echo $sql;  $rs = $this->db->query($sql);  return $rs;} 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.