so i am busy with a little project i started myself to learn php better, but is stumbled upon a little problem.
when i made the query in this script down here i thought it was working but when i run it with the form it gives this error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a5703565/public_html/login/editpassproces.php on line 14
the code:
[php]<?php
session_start();
$con = mysql_connect (“mysql14.000webhost.com”,“a5703565_belzug”,“QazWaz123”);
mysql_select_db(“a5703565_belzug”, $con);
$username = ‘cocco123’;
$result = mysql_query(“SELECT * FROM members WHERE username = cocco123”);
$row = mysql_fetch_array($result);
if($_POST[‘oldpass’] !== $row[‘password’]){
echo “Het wachtwoord is niet correct ingevuld probeer opnieuw.”;
}elseif( $_POST[‘newpass’] !== $_POST[‘validpass’] ){
echo $username;
echo $_SESSION[‘username’];
echo “De wachtwoorden komen niet overeen. Probeer het opnieuw.”;
} else{
$newpass = $_POST[‘newpass’];
mysql_query("UPDATE members SET password = $newpass WHERE username = $username ");
header(“location:http://bellinzonazug.webege.com/login/editpasssucces.php”);
}
?>[/php]
hope you guys can help me.
i tried to change the fetch_array into fetch_assoc but didn’t work, same error.
thanks in advance.