Jump to content

My mysqli_connect() problem


KeemW
Go to solution Solved by mac_gyver,

Recommended Posts

Hai, i'm not sure how to fix this error. any other method to update database?

 

Error:

 

 

Fatal error: Call to undefined function: mysqli_connect() in C:\xampp\htdocs\Sportify\admin\admin_goedit_profile.php on line 3

 

 

PHP:

<?php

$con=mysqli_connect("localhost","root","","sportify");
//check connection
if (mysqli_connect_errno())
{
echo "failed";
}


/* mysql_select_db(stationary, $con) or die("Could not select database"); */
/* include ('connection.php'); */

//$id = $_GET['id'];
$sql="UPDATE admin SET name='$_POST[name]', email='$_POST[email]', phone='$_POST[phone]', address='$_POST[address]' WHERE id = '$_POST[id]'";

if (mysqli_query($con,$sql))
{ 
header("Location: main_admin.php?page=admin_edit_profile.php&id='$_POST[id]'");
 //?id=".$_POST['id']."
}


mysqli_close($con);

?>
Link to comment
Share on other sites

apparently, your Windows system has php4. the things you are trying to use, mysqli and PDO, were added to php in php5 and only exist in php5.

 

if you are not going to use the at least the same MAJOR version of php that you used to developed your code, you shouldn't expect your code to run.

Link to comment
Share on other sites

parse errors that show up when moving between systems are usually due to using php's lazy short open <? tag, that's not portable between systems since it relies on a configuration setting, instead of using full opening tags <?php

 

i think i solved my problem. i didnt know that only mac can read the php's lazy short open tag

thank you!

Link to comment
Share on other sites

i didnt know that only mac can read the php's lazy short open tag

 

Who said that?

 

Whether or not short tags can be used depends on the short_open_tag setting. Appearently it's activated on your Mac, but it's not activated on your Windows PC. So either activate it on Windows as well, or simply remove all short tags to solve this problem once and for all.

Edited by Jacques1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.