pocobueno1388
Members-
Posts
3,369 -
Joined
-
Last visited
Never
Everything posted by pocobueno1388
-
[SOLVED] Parse error: syntax error, unexpected T_VARIABLE
pocobueno1388 replied to eaglelegend's topic in PHP Coding Help
Change <?php print "<td width='33%' valign='top'> <table border=0 cellpadding=2 cellspacing=0 width=100%> <Tr> <Td valign=middle align=center><img src='/images/pets/$species.png' alt="$petName"></td> <td valign=top class=other width=100%>$user adopted a $species<br> Name: $petName<br>Status: $s<br>Born: $date<br>Points: $points</td> </tr> </table> </td>"; To <?php print "<td width='33%' valign='top'> <table border=0 cellpadding=2 cellspacing=0 width=100%> <Tr> <Td valign=middle align=center><img src='/images/pets/$species.png' alt=\"$petName\"></td> <td valign=top class=other width=100%>$user adopted a $species<br> Name: $petName<br>Status: $s<br>Born: $date<br>Points: $points</td> </tr> </table> </td>"; You can't have double quotes within double quotes without escaping them. -
Tally the SUM of a column of a table ...
pocobueno1388 replied to xProteuSx's topic in PHP Coding Help
Something is needed to store the value in, so thats why the alias is there. Otherwise, what would you use to output the result? If you used $row['users_pageviewd'] it wouldn't make sense, because you didn't select that row from the database in the query. Thats the best I can explain it...hopefully it makes sense -
Tally the SUM of a column of a table ...
pocobueno1388 replied to xProteuSx's topic in PHP Coding Help
You code should be: <?php $tallypageviews = mysql_query("SELECT SUM(users_pagesviewed) as total FROM users"); $row = mysql_fetch_assoc($tallypageviews); echo 'Pages Viewed By All Members: '; echo $row['total']; -
Tally the SUM of a column of a table ...
pocobueno1388 replied to xProteuSx's topic in PHP Coding Help
There is a much easier way. SELECT SUM(PagesViewed) as total FROM tableName -
Whats the problem?
-
The code I posted is exactly what you need to do. Just add the first line, and replace your current query with the second line.
-
You never define $username before you do your query to check if it's already taken. Instead you use the variable $user which is defined for your database connection. <?php $username = $_POST['username']; $querycheck = "SELECT username FROM users WHERE username = '$username'";
-
Get the largest value from a MYSQL Table
pocobueno1388 replied to chanchelkumar's topic in PHP Coding Help
Why not just put an auto-increment field in the table? To get the max value +1 you would do this: SELECT MAX(field)+1 AS highest FROM table -
If you look at the site and KNOW how to do each script, then you are ready. If you don't know exactly what to do for something, then keep reading tutorials. www.tizag.com is a good site.
-
pasting quotes from db inside a textarea
pocobueno1388 replied to anarchoi's topic in PHP Coding Help
the textarea tag doesn't have a value attribute, you would do this: echo "<textarea>$value</textarea>"; -
What is wrong with the output URL? Wouldn't "u" be the persons username they want to request to be friends with, or is that the logged in users username? If it's the logged in users, then why don't you just pass the other users username through the URL as well? Make the link like this: http://example.com/main/friendrequest.php?user=u&request_freind=some_username
-
You need to use two equal signs, not one.
-
What is the problem? You pretty much have the link setup correctly. echo "<a href='friendrequest.php?user=$user[profileusername]'>Add as Friend</a>"."<br>"; If $user holds the username you want, I don't understand the problem.
-
Try this: <?php include inventory.php; $username = $_POST['username']; # Main connection information $db_host='localhost'; $db_database='#########'; $db_username='#######'; $db_password='#########'; $db_config = 'mysql'; /* I am building the query here, using the $selectedname variable that the user gets stored to in inventory.php */ $connection = mysql_connect($db_host,$db_username,$db_password); if (!$connection) { die ("Could not connect to database using supplied credentials"); } $db_select = mysql_select_db($db_database); if (!$db_select) { die ("Could not select database"); } $getphoneinfo = "SELECT * FROM inventory WHERE name = '".$selectedname."'"; if (!$getphoneinfo) { die ("Could not query database"); } $phone_query = mysql_query($getphoneinfo); if (!$phone_query) { die (mysql_error() . "<p>With Query:<br>$getponeinfo"); } $phone_fetch = mysql_fetch_assoc($phone_query); $number_phone = mysql_num_rows($phone_query); echo ' <html> <head> <title>Dover Chemical Cellphone Inventory System</title> </head> <body> <!-- create a table for the header banner --> <table bgcolor="00619e" height="150" width="100%"> <tr> <td align="center"><font color="white" size="+24">Dover Chemical Cellphone Inventory</font></td> </tr> <!-- close banner table --> </table> <hr width=50%></hr> <center> <table> <tr> <td><p> Account Number: <b>######### </b>| Password: <b>##########</b> | Call : <b>##############</b></p></td> </tr> </table> </center> <hr width=50%></hr> <!-- I stole this code from the dover website for whitespace, editing the table for height. Thanks Mr. Harr!!!! --> <table height="16%"> <tr> <td> <font color=#ffffff> --------- --------- --------- --------- --------- --------- --------- --------- </font> </td> </tr> </table> <!-- center it all up in one fell swoop! --> <div align="center"> <!-- now we need a table to place the form in --> <table> /* this part works, I just post in the selected user from the inventory.php page */ <!-- form used to select the appropriate user --> <label>Selected User: '; echo $username; echo '</label> <!-- done with the form piece --> <!-- now we close the container --> </table>'; echo ' <!-- now we need a table to put the various information about the users phone --> <br /> <br /> <table align="center" width="30%" height="20%"> <tr> <td>Cellphone model</td><td>'; echo $phone_fetch['model']; echo '</td> </tr> <tr> <td>Cellphone number</td><td>'; echo "blank" ; echo '</td> </tr> <tr> <td>IMEI number</td><td>'; echo "blank"; echo '</td> </tr> <tr> <td>SIM number</td><td>'; echo "blank"; echo '</td> </tr> <!-- close information table --> </table> </div> <!-- poor mans whitespace, not as cool as brians --> <br /> <br /> <br /> <!-- Copyright mumbo-jumbo...gotta cover your ass now adays --> <center><font size="-14" face="papyrus">Copyright © 2008 Dover Chemical Corporation</font></center> </body> </html> '; mysql_close(); ?>
-
I don't see any comments that show the problem. You also never specify the exact problem. Is the query not returning any results?
-
<?php foreach ($_SESSION as $key => $val){ echo "$key - $val <br />"; }
-
Nope, the site won't work.
-
No, "time" is not a reserved word. Have you tried printing out the query? Change echo "<p>There was a problem updating the developer.</p>",mysql_error(),"<br />"; To echo "<p>There was a problem updating the developer.</p>",mysql_error(),"<br />$query";
-
<?php if (isset($_SESSION['login'])){ print<<<HERE ALL HTML CODE GOES HERE HERE; } else { header("Location: login.php"); } ?>
-
I would store the drug_id in the checkbox array. So change your checkbox creation line to: echo "<input type='checkbox' name='ticked[]' value='{$row['drug_id']}'>"; Then at the top of your page, you can do this to see what has been checked: <?php if (isset($_POST['ticked'])){ echo "The following drugs were chosen:<p>"; foreach ($_POST['ticked'] as $drugID){ echo $drugID.'<br>'; } } ?>
-
Try to catch the error with a die statement, also try taking the quotes from around "Clients". mysql_query("INSERT INTO Clients (ID, FName, LName, PHON) VALUES ('NULL', '$FName', '$LName', '$PHON'")or die(mysql_error());
-
It should look something like this: <?php if (isset($_POST['submit'])){ $choice = $_POST['choice']; echo "The user selected <b>$choice</b><p>"; } $query = mysql_query("SELECT * FROM TABLE"); echo '<form>'; while ($row = mysql_fetch_assoc($query)){ echo "<input type='radio' name='choice' value='{$row['unique_col']}'><br>"; } echo '<input type="submit" name="submit">'; echo '</form>'; ?>
-
Okay, here is a tutorial that breaks it down for you: http://www.tizag.com/mysqlTutorial/mysqltables.php
-
This page should explain everything: http://dev.mysql.com/doc/refman/5.0/en/create-table.html
-
I'm sure it's possible, I'm just not exactly sure exactly what you mean when you say "bullet form".