Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Scrapping...mysqli_error() expects parameter 1 to be mysqli, integer given
    primarykey
    data
    text
    <p><strong>UPDATE: i solved it and here is the working code: <a href="http://pastebin.com/51TfZm2R" rel="nofollow">http://pastebin.com/51TfZm2R</a> let me know if u have any questions or if maybe i did something wrong on my part in the code. cheers!</strong></p> <p>hey there I'm having trouble with my php code, its giving me this error when debugging it in Zend Studio 10:</p> <p>mysqli_error() expects parameter 1 to be mysqli, integer given (line 83)</p> <p>I wish to add data into the 'events' database but when I check on the database and table in phpmyadmin no rows were added. no data at all!</p> <p>any help is greatly appreciated! here is my code:</p> <pre><code>&lt;?php date_default_timezone_set('Europe/Belgrade'); header('Content-Type: text/plain; charset=utf-8'); // MySQL connection parameters $hostname = "localhost"; $username = "bla1234"; $password = "blabla"; $database = "mysql"; // Create a database handle $dbh = mysqli_connect($hostname, $username, $password, $database) or die("Unable to connect to MySQL"); echo "Connected to MySQL\n"; // Create database $dbh-&gt;query("CREATE DATABASE events"); echo "Created events database\n"; // Select database $dbh-&gt;query("USE events"); echo "Selected events database\n"; // Create table $dbh-&gt;query("CREATE TABLE eventlist(PID INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(PID), Name VARCHAR(30), Day INT, Month VARCHAR(10), Until VARCHAR(200), Category VARCHAR(20), Info VARCHAR(200))"); echo "Created events table\n"; echo "\n\n"; // PHP Scrapping $contents = file_get_contents('http://www.tob.rs/en/events_list.php'); $regexp1 = '/&lt;div class="list\\_articles/'; $records = preg_split($regexp1, $contents); for ($ix=1; $ix &lt; count($records); $ix++) { $tmp = $records[$ix]; preg_match('/events\\.php\\?id=[0-9][0-9][0-9]"&gt;(.*?)&lt;/', $tmp, $match_name); preg_match("/&lt;p class='day'&gt;(.*?)&lt;/", $tmp, $match_day); preg_match("/&lt;p class='mon'&gt;(.*?)&lt;/", $tmp, $match_month); preg_match("/&gt;[\s]*(.*?)&lt;a/", $tmp, $match_until); preg_match('/events_list\\.php\\?t=[0-9]"&gt;(.*?)&lt;/', $tmp, $match_cat); preg_match('/&lt;p&gt;(.*?)&lt;/', $tmp, $match_info); $Name = $match_name[1]; $Day = $match_day[1]; $Month = $match_month[1]; $Until = $match_until[1]; $Category = $match_cat[1]; $Info = $match_info[1]; echo "Name: " . $Name . "\n"; echo "Day: " . $Day . "\n"; echo "Month: " . $Month . "\n"; echo "Until: " . $Until . "\n"; echo "Category: " . $Category . "\n"; echo "Info: " . $Info . "\n"; echo "\n\n"; echo "---------------------------------------------------------------------------------"; echo "\n\n"; $sql = "INSERT INTO `events`.`eventlist` (PID, Name, Day, Month, Until, Category, Info) VALUES (NULL, $Name, $Day, $Month, $Until, $Category, $Info)"; mysqli_query($dbh, $sql); } mysqli_close($dbh); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload