Jump to content

[Answered] Getting Mysqli


L09Luka

Recommended Posts

That doesn't work unless you have defined the function db() and it returns a query to run on the server. Try this code:

<?php
$dbcon = mysqli_connect("localhost","username","password");
if (!$dbcon)
{
die("MySQL error: " . mysqli_connect_error());
}
$query = mysqli_query("SELECT * FROM `cpuser_dbname`.`Table`");
// code to process query
mysqli_close($dbcon);
?>

 

Replacing username and password with the MySQL user and password, and cpuser_dbname and Table with the respective values.

 

IMPORTANT: A huge difference between mysql and mysqli is the query command. Commands that retrieve data from the database (such as SELECT) use the mysqli_query() function. However, commands that edit data (such as INSERT, UPDATE, ALTER, etc.) use the mysqli_real_query() command.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...