Meza44
-
Posts
5 -
Joined
-
Last visited
Never
Posts posted by Meza44
-
-
I am creating a phone directory database and I don't want to have to hand format each phone number is there a way for php to either format it before inserting it into the database or formatting it when calling it from the db in the format (555)555-5555.
thanks for all your help I am so green with php that I am lost most times.
Meza44 -
I get this error message from my code and I don't know why. I am new to php.
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/content/i/b/e/ibezamn/html/change.php on line 15
<html>
<head><title>Ibezamn - Update</title>
</head>
<?
$id=$_GET['id'];
include("capsroster.inc.php");
mysql_connect(localhost,$username,$password);
$query="SELECT * FROM roster WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while($i<$num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$number=mysql_result($result,$i,"number");
$position=mysql_result($result,$i,"position");
$height=mysql_result($result,$i,"height");
$weight=mysql_result($result,$i,"weight");
$shoots=mysql_result($result,$i,"shoots");
$dob=mysql_result($result,$i,"dob");
?>
<form action="update.php" method="get">
<input type="hidden" name="ud_id" value="<? echo $id; ?>"><br>
First:<input type="text" name="ud_first" value="<? echo $first; ?>"><br>
Last:<input type="hidden" name="ud_last" value="<? echo $last; ?>"><br>
Number:<input type="hidden" name="ud_number" value="<? echo $number; ?>"><br>
Height:<input type="hidden" name="ud_height" value="<? echo $height; ?>"><br>
Weight:<input type="hidden" name="ud_weight" value="<? echo $weight; ?>"><br>
Shoots:<input type="hidden" name="ud_shoots" value="<? echo $shoots; ?>"><br>
DOB:<input type="hidden" name="ud_dob" value="<? echo $dob; ?>"><br>
<input type="submit" value='Update">
</form>
<?
++$i;
}
?>
</body>
</html> -
thank you
-
I am new to PHP and Mysql I am getting an error from a piece of code that I copied from a tutorial and don't know how to fix it.
Here is the error
Parse error: parse error, unexpected ',' in /home/content/i/b/e/ibezamn/html/insert.php on line 21
Here is my code
<html>
<head><title>Insert.PHP</title></head>
<body>
<?
include("/php/capsroster.inc.php");
$first=$_POST['first'];
$last=$_POST['last'];
$number=$_POST['number'];
$position=$_POST['position'];
$height=$_POST['height'];
$weight=$_POST['weight'];
$shoots=$_POST['shoots'];
$dob=$_POST['dob'];
mysql_connect(mysql213.secureserver.net,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query="INSERT INTO roster VALUES(",'$first','$last','$number','$position','$height','$weight','$shoots','$dob')";
mysql_query($query);
mysql_close();
?>
<a href="websiteinputform2.html">Add another player</a>
</body>
</html>
Thank you
PHP and phone numbers
in PHP Coding Help
Posted