[Solved] Object of class mysqli_result could not be converted to int – Can’t find my Error [duplicate]

mysqli_query does not return your number directly. It returns a mysqli_result as you can see here. To get the row you have parsed, you should fetch it first: $row = mysqli_fetch_assoc($result) A lot of information on using mysqli can be found here. 6 solved Object of class mysqli_result could not be converted to int – … Read more

[Solved] mysqli calling same data twice [duplicate]

Returns an array that corresponds to the fetched row and moves the internal data pointer ahead. The internal data point is still at the end when you try to use your second while loop. You have done nothing to reset it. You can move it back to the start with mysqli_data_seek($result, 0); Update: when first … Read more

[Solved] How do i add space between this php variables

You’re generating invalid HTML. This: ‘<option value=”. $spName . ” ‘ . $spPro .’>’ ^— WITH the added space Will produce something like this: <option value=SomeName SomeProfession> The browser has no way of knowing that these two values are part of the same attribute. In short, you forgot the quotes. You want to generate something … Read more

[Solved] how to save data from textboxes to database on submit button click using php

The html code below is a snippet of how your form should look, though you have mentioned you already have this part done: page1.html <form method=”POST” action=”page2.php”> <input type=”text” name=”usernameForm”> <input type=”password” name=”passwordForm”> <input type=”submit” value=”Submit”> </form> The php code below then obtains the variables from page1.html after a user Submits their information from the … Read more

[Solved] Trying to convert mysql to mysqli, not working

Just for a quick testing purpose, try this below which is a bare bones method. You can then slowly build up sanitizing and troubleshoot from thereon. <?php $username = $_POST[‘username’]; $password = sha1($_POST[‘password’]); $link = mysqli_connect(‘xxx’, ‘xxx’, ‘xxx’, ‘xxx’); $query = “SELECT password, id FROM users WHERE username=”$username” AND password=’$password'”; $result = mysqli_query($link, $query); if(mysqli_num_rows($result) … Read more

[Solved] Error in an update mysql query execution with php and mysqli [duplicate]

You need to escape the single quotes using php’s str_replace, e.g.: $exp_title = str_replace(“‘”, “\'”, $_REQUEST[‘exp_title’]); $exp_description = str_replace(“‘”, “\'”, $_REQUEST[‘exp_description’]); $exp_time = $_REQUEST[‘exp_time’]; $update=”UPDATE experience SET exp_title=””.$exp_title.”” , exp_description='”.$exp_description.”‘ , exp_time=””.$exp_time.”” WHERE expid='”.$id.”‘”; However, you should really really use preparedstatements instead of concatenating strings and escaping characters, e.g.: $exp_title = $_REQUEST[‘exp_title’]; $exp_description = $_REQUEST[‘exp_description’]; … Read more

[Solved] php + Highcharts.js + convert from mysql to mysqli causes error [duplicate]

If you are going to convert your code to mysqli_*, then it should be in a prepared statement manner. Lets re-establish your MySQL connection in db.inc.php: <?php $conn = new mysqli(“localhost”, “Datenbank-Username”, “Datenbank-Passwort”, “Datenbank-Name”); /* CHECK CONNECTION */ if (mysqli_connect_errno()) { printf(“Connect failed: %s\n”, mysqli_connect_error()); exit(); } /* CHANGE CHARACTER SET TO utf8 */ if … Read more

[Solved] selecting multiple rows mysqli

It was pretty simple, I don’t know why do I get a vote down every time I ask question. $mysqli = new mysqli(“localhost”, “root”, “”, “database”); if ($mysqli->connect_errno) { echo “Failed to connect to MySQL: (” . $mysqli->connect_errno . “) ” . $mysqli->connect_error; } $username = $_SERVER[‘REMOTE_ADDR’]; $stmt = $mysqli->prepare(“select * from `vpb_uploads` where `username` … Read more

[Solved] php bind_param number of variables doesn’t match number of parameters

You get the error because you bind 7 params to the query, but don’t use any of them. Instead you insert the variables directly into the query, which leads to the data being (insecurely) inserted into the database. $insert = $this->con->db->prepare(‘UPDATE users SET firstName=”‘.$updateFirstName.'”, lastName=”‘.$updateLastName.'”, username=”‘.$updateUsername.'”, email=”‘.$updateEmail.'”, profileImage=”‘.$updateProfileImage.'”, bio=”‘.$updateBio.'” WHERE userID = ‘.$userID); should be … Read more

[Solved] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 5

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 5 solved You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near … Read more

[Solved] change mysql to pdo and store result in variable

Try this: <?php $games_sql = “SELECT id,col1,col2,now FROM tblname ORDER BY now ASC LIMIT 9”; $sth = $conn->query($games_sql); $sth->setFetchMode(PDO::FETCH_ASSOC); $gn=0; while ($game_get = $sth->fetch()) { $id = $game_get[‘id’]; $col1 = $game_get[‘col1’]; $col2 = $game_get[‘col2’]; $now = $game_get[‘now’]; $gametimeanddate = jdate(“l d M y time G:i”,$now); $gamedate = jdate(“l d M y”,$now); $gametime = jdate(“G:i”,$now); //SAVE … Read more

[Solved] Myqli php login [duplicate]

You should have a database name for mysqli_connect. So, go like this: $connect=mysqli_connect(‘localhost’,’root’,”,’databse_name’); and why are you using __mysqli_ston for?Use this instead $query = mysqli_query($connect, “SELECT * FROM users WHERE username=”$username””); Do not use __mysqli_ston. This should work.If doesn’t work,get back to me. solved Myqli php login [duplicate]

[Solved] Fatal error in if stament [duplicate]

Just change the condition to: if(isset($_REQUEST[‘userid’]) && $_REQUEST[‘userid’] > $user_hack) isset tells is a variable is set, while this statement may be true or false, on which you cannot call isset function. Until you check if(isset($_REQUEST[‘userid’])), you cannot assign it to $userid variable. 2 solved Fatal error in if stament [duplicate]