-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by partTimeRunner
-
-
I need to send the data gathered from a web form to my database. The connection works, and I can use the data gathered from post to make a query statement that works when used in mysql directly. My php script fails when I call the mysql_query() function. No error is displayed despite having the conditional right after it. My code:
<?phpini_set ("display_errors", "1");error_reporting(E_ALL); $connection=mysqli_connect(/* not shown */); if (mysqli_connect_errno()) { echo "Failed to connect to database: " . mysqli_connect_error(); } $_clubName = $_POST['clubname']; $_clubRep = $_POST['clubrep']; $_meetingID = $_POST['meeting_id']; $_query = "UPDATE oh_checkin_2015 SET clubrep = '$_clubRep', meeting_2 = $_meetingID WHERE clubname = '$_clubName'"; $_result = mysql_query($_query); if (!$_result) die ("Database query failed: " . mysql _error()); else {echo 'successful query';}?>
I have tried my best to locate the problem on my own and have looked up many other forums for a possible solution. If anyone can help me out with this, it would be greatly appreciated.
-
Okay. I was going to do that as a last resort. Thanks!
-
A few weeks ago I was given admin control of a Windows server. On it mySQL was already installed with no user accounts and databases set up. I have tried logging in as root, localhost, ect but any default account has been stripped of privileges.
For example I get an error message reading: “Access denied for user ‘root’@’localhost’ (using password NO)”.
This was done probably for security purposes. Either way I need to be able to set up an account so that I can make my database. My question – is it possible to create an account or give root the rights required to log into mySQL without already being logged in? The person who gave the server to me said that I would not need an account in order to make the database. This confuses me because with the limited experience I have had with mySQL I have had to been logged in to make any kind of change.
What do you guys suggest?
mysql_query() error in PhP
in PHP
Posted
Ah! I need to be using VIM to spot these sort of things. Anyway, after fixing the conditional I did end up receiving errors:
'expects parameter 2 to be resource' and 'expects parameter 1 to be mysqli'
which can be fixed by changing the mysql_ funtions into mysqli_
Problem solved. Thanks for the help.