Jump to content

preg_match error?


2old2learn?

Recommended Posts

HeyI am working on a login script that looks pretty good..right now I get this error on the register.php

return preg_match("^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$", $email);

This is the error message:

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in C:\xampp\htdocs\html_login\source\include\formvalidator.php on line 237
thanksLOL ... sorry solved..
return preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/", $email);

Do you see where I found the error??But now I get a new error message...LOL

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'billj'@'localhost' (using password: YES) in C:\xampp\htdocs\html_login\source\include\fg_membersite.php on line 497
LOL...again damn even before I posted the above error I think I found the solution...but I will still post it just in case....LOLWell, you see I am trying made an adjustment..to script and now get this error..
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or T_VARIABLE or '{' or '$' in C:\xampp\htdocs\html_login\source\include\fg_membersite.php on line 497
here is the code for fg_membersite.php line 497 file..
$this->connection = mysql_connect($this->'localhost',$this->'root',$this->'');

Cheers..

Link to comment
Share on other sites

Hey
$this->connection = mysql_connect($this->'localhost',$this->'root',$this->'');

it should either be something like
$this->connection = mysql_connect('localhost','root','');

or

$this->connection = mysql_connect($this->domain, $this->username, $this->password);//assumed variable names, but used to illustrate a point

depending on your application, because this syntax

$this->'string';

is incorrect.

Link to comment
Share on other sites

Hey sorry for not getting back on this ...sooner...but took a bit of a break..from all of this..absorbing abit too much..and many scripters..have different styles of doing scripts so I was getting confused..especially for login scripts..many of which are dated..and have to do a whole re-work of their script work in order for them to work...as for db connect:

$this->connection = mysql_connect('localhost','root','');

Yea went that direction but still in a different way though..:

$con = mysql_connect("localhost","root","");  if (!$con){   die('Could not connect: ' . mysql_error());   };	   mysql_select_db("tecicc", $con);

found this one works better...looking to make a single config.php file for connections and other function/include files..to make all easier..

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...