Wednesday, August 29, 2018

php - MySQL database xampp

I am trying to make a forum but for that i need a database whit data.
this are my scripts :




(Connect and printdata script)



    


Login Page



















function connect() {
$con=mysqli_connect("localhost", "root", "", "forum");
var_dump($con);
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();

} else {
return $con;
}
}

function renderContent($con) {
$sql = "SELECT * FROM textforum";
$result = $con->query($sql);




// output data of each row

echo $row["text"]. "
";



}



and the output error is:




object(mysqli)#1 (19) { ["affected_rows"]=> int(0) ["client_info"]=> string(79) "mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $" ["client_version"]=> int(50011) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(0) ["host_info"]=> string(20) "localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(21) "5.5.5-10.1.21-MariaDB" ["server_version"]=> int(50505) ["stat"]=> string(134) "Uptime: 7020 Threads: 1 Questions: 1674 Slow queries: 0 Opens: 38 Flush tables: 1 Open tables: 30 Queries per second avg: 0.238" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(177) ["warning_count"]=> int(0) }



Notice: Undefined variable: row in C:\xampp\htdocs\LoginTest\Login\process.php on line 42




ankit :
this is my output :

object(mysqli)#1 (19) { ["affected_rows"]=> int(0) ["client_info"]=> string(79) "mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $" ["client_version"]=> int(50011) ["connect_errno"]=> int(0) ["connect_error"]=> NULL ["errno"]=> int(0) ["error"]=> string(0) "" ["error_list"]=> array(0) { } ["field_count"]=> int(0) ["host_info"]=> string(20) "localhost via TCP/IP" ["info"]=> NULL ["insert_id"]=> int(0) ["server_info"]=> string(21) "5.5.5-10.1.21-MariaDB" ["server_version"]=> int(50505) ["stat"]=> string(134) "Uptime: 8825 Threads: 1 Questions: 1683 Slow queries: 0 Opens: 38 Flush tables: 1 Open tables: 30 Queries per second avg: 0.190" ["sqlstate"]=> string(5) "00000" ["protocol_version"]=> int(10) ["thread_id"]=> int(182) ["warning_count"]=> int(0) }
Text blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblbText blalblalblb



the blalblalblbText is the correct output but the rest not how do i get rid of it.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...