KeemW Posted August 28, 2014 Share Posted August 28, 2014 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 https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/ Share on other sites More sharing options...
CroNiX Posted August 28, 2014 Share Posted August 28, 2014 It means you don't have the mysqli extension enabled in your php.ini. Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489147 Share on other sites More sharing options...
KeemW Posted August 28, 2014 Author Share Posted August 28, 2014 Im using old xampp. Should i update it? but im using php4 Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489148 Share on other sites More sharing options...
Jacques1 Posted August 28, 2014 Share Posted August 28, 2014 PHP 4? Are you serious? Then appearently you haven't updated your XAMPP since 10 years. It's about time. Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489150 Share on other sites More sharing options...
IanA Posted August 28, 2014 Share Posted August 28, 2014 Wow, yes most definitely update. The latest version of PHP 4 has been depricated since 2008... Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489153 Share on other sites More sharing options...
mac_gyver Posted August 28, 2014 Share Posted August 28, 2014 the last ever update of php5.3 was just released. you should be using the latest php5.5 or 5.4, especially if you are learning php. Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489155 Share on other sites More sharing options...
KeemW Posted August 28, 2014 Author Share Posted August 28, 2014 Just wanna know if my website file take from macOS and run it in Windows why all the file have alot of error? Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489158 Share on other sites More sharing options...
mac_gyver Posted August 28, 2014 Share Posted August 28, 2014 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 https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489159 Share on other sites More sharing options...
CroNiX Posted August 28, 2014 Share Posted August 28, 2014 Probably because the php versions are different and have different extensions enabled Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489160 Share on other sites More sharing options...
KeemW Posted August 28, 2014 Author Share Posted August 28, 2014 when i run on windows, alot of file have this error: Parse error: syntax error, unexpected $end in But on mac nothing problem. php version running on mac is 5.3.1 same as version on windows. Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489166 Share on other sites More sharing options...
mac_gyver Posted August 28, 2014 Share Posted August 28, 2014 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 Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489168 Share on other sites More sharing options...
jazzman1 Posted August 28, 2014 Share Posted August 28, 2014 mysqli and PDO, were added to php in php5 and only exist in php5. No, pdo wasn't added prior php 5-1.0. I remember that b/s at the same time they added pdo-mysql and pdo-firebird drivers Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489171 Share on other sites More sharing options...
KeemW Posted August 28, 2014 Author Share Posted August 28, 2014 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 https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489172 Share on other sites More sharing options...
Jacques1 Posted August 28, 2014 Share Posted August 28, 2014 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. Link to comment https://forums.phpfreaks.com/topic/290699-my-mysqli_connect-problem/#findComment-1489173 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.