Mysql error expects parameter 1 to be resource string

The reason it failed is because you have escaped the back ticks in the PHP string where you did not need to. Your lines look like this:. Don' t write new code that uses the mysql_ * functions. It is much better to check the errors explicitly after every function call. Since it looks like it' s being done procedurally try changing your mysql stuff which has been deprecated to mysqli. It' s likely you. mysql_ query returns FALSE if the query had an error, in your case, where you are using it for a SELECT type query. Parameter 1: Database connection Variable which contains you database table, username and password info. Warning: mysql_ fetch_ array( ) expects parameter 1 to be resource, string given HELPPP. mysql_ error( ) expects parameter 1 to be resource, string given. Everything works fine, but it shows these errors. The error handler is supposed to print the " surrounding code" for all mysql related warnings/ errors and the ( raw) output should. You' re trying to give it a string. You' re missing a step. You' ll have to execute that query first:.

  • Transport error java net noroutetohostexception no route to host
  • Javascript runtime error uint8array is undefined
  • 500 internal server error asp net web method
  • Lineage 2 agp error windows 7


  • Video:Resource string parameter

    Resource string expects

    You' d be mising mysqli and mysql calls, which is not supported. They' re completely independent of each other internally, and a db. Your sql queries should be: mysqli_ query( " INSERT INTO Persons ( FirstName, LastName, Age) VALUES ( ' Naruto', ' Uzumaki', 18) ", $ dbhandle) ; mysqli_ query( " INSERT INTO Persons ( FirstName, LastName, Age) VALUES. mysql_ fetch_ array( ) expects parameter 1 to be resource, string given [ duplicate] · php mysql oop. You are passing in $ query which is your sql string, when you need to pass in $ result which is your db result object. class DBQueries extends. You have two errors in the same line of code: 1) You are mixing mysql and mysqli API which you cannot do. 2) You are passing the query to your function instead of the result resource: while( $ riga = mysql_ fetch_ array( $ sel) ) {. your mysql connect should be like that mysql_ connect( ' localhost', ' root', ' mysql_ password' ) ; ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ you forgot this. you forgot password.

    and you should not use mysql but instead use PDO or MYSQLI. if you sult is false because your query is invalid ( has a syntax error). Finally, for future reference, if your query doesn' t work, print the error and the SQL query used ( something like what' s on Col Shrapnel' s answer). The error handler is supposed to print the " surrounding code" for all mysql related warnings/ errors and the ( raw) output should look like < fieldset> < legend> mysql_ fetch_ assoc( ) expects parameter 1 to be resource, string given.