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); ?> Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
KeemW Posted August 28, 2014 Author Share Posted August 28, 2014 (edited) Im using old xampp. Should i update it? but im using php4 Edited August 28, 2014 by KeemW Quote Link to comment 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. 1 Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Solution mac_gyver Posted August 28, 2014 Solution 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 Quote Link to comment 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 Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 28, 2014 Share Posted August 28, 2014 (edited) 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 August 28, 2014 by Jacques1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.