Thursday 15 May 2014

php - Array in database error -


I have an array of user names that need to be matched with the DB table on the post.

When I post it, I get the following error:

Warning: mysqli_fetch_row () parameter 1 is expected to be mysqli_result, boolean / hermes / waloraweb008 / B2049 / info / folder / page. This array creates following the @ sign (works fine):

  $ postpay on $ php 43 | 213   $ 1   

It is that I want to check for the array within DB.

  $ mentionsql = "Choose * From Users Where Username $ $ shiz '"; $ Mentionquery = mysqli_query ($ db_conx, $ mentionsql); $ Row83 = mysqli_fetch_row ($ mentionquery); $ Music name = $ line 83 ["user name"];   

so that I can do this later:

  mysqli_query ($ db_conx, "INSERT INTO notifications (user name, initiator, app, which_stats, Was done, date_time) value ('$ music name', '$ log_username', '& lt; a href = user.php? U = $ log_username & gt; $ log_username & lt; / a & gt; in a state Have mentioned you. ',' $ Statusid ', now (), now and ()) ");   

Why any error is there?

As far as I can interpret your code $ shiz with commas The different string is the user name, therefore: $ shiz == 'user1, user2, user3'

You are generating your query on this line:

  $ mentionsql = "Select * Usernames where the user name in '$ shiz';   

If you include your example of $ shiz So you receive a question like this:

  "Select * The actual syntax for the SQL command requires round brackets, however, if the user names are string, then the WHERE user name IN 'user1, user2, user3' "  

Then you have to put it in a single quote. So your query should look like this:

  "Select * user WHERE user name IN ('user1', 'user2', 'user3') "   

No comments:

Post a Comment