Skip to content

Tag: mysql

can not access to database in moodle

I am using moodle and I change location of my web site, but I am facing this error. My config.php is: And my error is: Error: Database connection failed. It is possible that the database is overloaded or otherwise not running properly. The site administrator should also check that the database details have be…

Parse JSON To Create SQL Insert Statements in PHP

I’m a newbie programmer trying to find my way in the world. I’ve got my hands on JSON data that I’m trying to parse out into SQL statements to populate multiple database tables. I would like to loop through each dimension of the array and pull out specific parts of it to create an INSERT sta…

Submitting a form using

I’m having a little trouble with this and can’t see what I’m doing wrong. I have this form: So when the user clicks the button it should submit the form then have this PHP to act upon the form (I know that the sql isn’t a prepared statement and is vulnerable to injections but this will…

PHP/MySQL: Get name for specific ID

I am a beginner to MySQL and Im trying to retrieve a name for a specific ID. Here is how my database looks like: I have a table of contacts which contains ID, first and last name. I want to retrieve the first and last name for a specific ID in the same form. So I want to end up

Resetting array pointer in PDO results

I’m having trouble moving from MySQL SELECT methods to PDO methods. I want to iterate through a fetched array twice, both times starting with row zero. In MySQL I would use: Using PDO methods, I’m not sure how to accomplish the same thing. The code below is how I am trying to do this. The first wh…