Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- All;
- I have the code:
- #1 $sql_str = "SELECT * FROM mydb.mytab WHERE `field` LIKE '%swomething%';";
- #2 $dbc = new mysqli('localhost','mydb','mypass','mydb') or die(mysqli_error());
- #3 $dbc_res = $dbc->query ( $sql_str );
- #4 $qry_nrs = $dbc_res::$num_rows ( $dbc_res );
- #5 $qry_nrs = $dbc_res->$num_rows ( $dbc_res );
- #6 $qry_nrs = mysqli_num_rows ( $dbc_res );
- #7 $qry_nrs = $dbc_res::$num_rows;
- #8 $qry_nrs = $dbc_res->$num_rows;
- I've tried all five methods lines #4-8 and none work, but this is syntax from PHP manual, so what am I not percieving and therefore doing wrong?
- Cheers!
- TBNK
- OK!
- var_dump results:
- object(mysqli_result)#3 (5) {
- ["current_field"]=>
- int(0)
- ["field_count"]=>
- int(6)
- ["lengths"]=>
- NULL
- ["num_rows"]=>
- int(0)
- ["type"]=>
- int(0)
- }
- This is a test for existing data row so since nothing in the DB.Table NULL is the correct response.
- Now assuming the error is that it can't handle the NULL.
- What is the right code for handling the NULL?
- Cheers!
- TBNK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement