php connection ERROR

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

61 Replies - 1512 Views - Last Post: 15 May 2019 - 04:47 PM Rate Topic: -----

#1 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

php connection ERROR

Posted 07 May 2019 - 09:19 AM

hy guya im doing mysql data base and it works so i wont post sql code here....i have a problem with php code...when i try to run it(from we localhost i get this(Fatal error: Uncaught Error: Call to undefined function msqli_connect() in C:\xampp\htdocs\sql\firs.php:5 Stack trace: #0 {main} thrown in C:\xampp\htdocs\sql\firs.php on line 5) ERROR does anyone know why?? tnx for help guys



PS:my dbpass is not realy (XXXXX) but i posted here like that.
php code(firs.php)
<?php
	$dbhost='localhost:3036';
	$dbuser='root';
	$dbpass='XXXXXX';
	$conn=msqli_connect($dbhost,$dbuser,$dbpass);

	if(!$conn)
	{
		die('coud not connect'.mysql_error());
	}

	$sql='INSERT INTO allien_abduction'.'(first_name,last_name,when_it_happend,how_long,how_many,allien_description,what_they_did,fang_spotted,other,email)'.
	'VALUES "sally","jones","3 day ago","2 days","four","green with six tencles","we just talk and pleyed with a dog","yes","i may seen your dog.contact me","[email protected]"())';
	mysql_select_db('test db');
	$retval=mysql_query($sql,$conn);

	if(!$retval)
	{
		die('could not enter datat' .mysql_error());
	}

	echo "Enter data sucesfuly";
	mysql_close($conn);



?>



Is This A Good Question/Topic? 0
  • +

Replies To: php connection ERROR

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14994
  • View blog
  • Posts: 59,862
  • Joined: 12-June 08

Re: php connection ERROR

Posted 07 May 2019 - 09:24 AM

What version of php is this?

Is the database service running?
Was This Post Helpful? 0
  • +
  • -

#3 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2836
  • View blog
  • Posts: 11,132
  • Joined: 03-December 12

Re: php connection ERROR

Posted 07 May 2019 - 09:24 AM

Um, check that spelling again. The error is apparent, but you are seeing what you think should be there. (hint: it's a typo)
Was This Post Helpful? 0
  • +
  • -

#4 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

Re: php connection ERROR

Posted 07 May 2019 - 09:26 AM

version is 7.3.4 database is runing through xampp
Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14994
  • View blog
  • Posts: 59,862
  • Joined: 12-June 08

Re: php connection ERROR

Posted 07 May 2019 - 09:26 AM

Waaaaaaaaaaaait a minute. Where'd ya copy that from?


msqli_connect

Isn't that supposed to be 'mysqli_connect'?
Was This Post Helpful? 0
  • +
  • -

#6 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

Re: php connection ERROR

Posted 07 May 2019 - 09:35 AM

i didint copy...im helping with this


My link
Was This Post Helpful? 0
  • +
  • -

#7 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4227
  • View blog
  • Posts: 13,399
  • Joined: 08-June 10

Re: php connection ERROR

Posted 07 May 2019 - 09:35 AM

Note, even if you fix the typo, your code will not run as the mysql extension has finally been removed from PHP 7.
Was This Post Helpful? 0
  • +
  • -

#8 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2836
  • View blog
  • Posts: 11,132
  • Joined: 03-December 12

Re: php connection ERROR

Posted 07 May 2019 - 09:38 AM

Dorm, mysqli, not mysql_

View Postkretze, on 07 May 2019 - 11:35 AM, said:

i didint copy...im helping with this


My link

“This” won’t work on php 7 regardless.
Was This Post Helpful? 1
  • +
  • -

#9 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14994
  • View blog
  • Posts: 59,862
  • Joined: 12-June 08

Re: php connection ERROR

Posted 07 May 2019 - 09:40 AM

Reason enough why I go the extra mile to shave the yak and write my own data base communication tools in VBS so they are timelessly available. hahahaha!
Was This Post Helpful? 0
  • +
  • -

#10 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

Re: php connection ERROR

Posted 07 May 2019 - 09:41 AM

ye i see my "typo" but like you said didnt worky anyway...so i must downloaded PDO??
Was This Post Helpful? 0
  • +
  • -

#11 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2836
  • View blog
  • Posts: 11,132
  • Joined: 03-December 12

Re: php connection ERROR

Posted 07 May 2019 - 09:47 AM

mysqli_ functions are still there. mysql_ functions are not. See the documentation.

However PDO is better, but you said "im helping with this". So, what are you helping with? Or did you mean that was the code you were using?
Was This Post Helpful? 1
  • +
  • -

#12 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

Re: php connection ERROR

Posted 07 May 2019 - 10:20 AM

yes that is code that i using
Was This Post Helpful? 0
  • +
  • -

#13 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

Re: php connection ERROR

Posted 07 May 2019 - 10:34 AM

hey can anyone help me how can i fix thi two erros(Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\sql\firs.php on line 5) and
(Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\sql\firs.php on line 9
coud not connect)

my php code now looks like that
<?php
	$dbhost='localhost:3306';
	$dbuser='root';
	$dbpass='XXXXXX';
	$conn=mysqli_connect($dbhost,$dbuser,$dbpass);

	if(!$conn)
	{
		die('coud not connect'.mysqli_error());
	}

	$sql='INSERT INTO allien_abduction'.'(first_name,last_name,when_it_happend,how_long,how_many,allien_description,what_they_did,fang_spotted,other,email)'.
	'VALUES "sally","jones","3 day ago","2 days","four","green with six tencles","we just talk and pleyed with a dog","yes","i may seen your dog.contact me","[email protected]"())';
	mysqli_select_db('test db');
	$retval=mysqli_query($sql,$conn);

	if(!$retval)
	{
		die('could not enter datat' .mysqli_error());
	}

	echo "Enter data sucesfuly";
	mysqli_close($conn);



?>



This post has been edited by kretze: 07 May 2019 - 10:34 AM

Was This Post Helpful? 0
  • +
  • -

#14 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2287
  • View blog
  • Posts: 6,978
  • Joined: 15-January 14

Re: php connection ERROR

Posted 07 May 2019 - 10:56 AM

Quote

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES

Read the error message, what is it telling you?
Was This Post Helpful? 0
  • +
  • -

#15 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 75
  • Joined: 22-October 18

Re: php connection ERROR

Posted 07 May 2019 - 11:08 AM

i know that many of you will now thinkig "what wrong with thgis guy" or something like that but i honestly dont know what i nedd to do that that php code will work
Was This Post Helpful? 0
  • +
  • -

  • (5 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »