Philip
Staff Alumni-
Posts
4,665 -
Joined
-
Last visited
-
Days Won
20
Everything posted by Philip
-
What data is in the database?
-
Make $worked[active] -> $worked['active'] and $worked[id] -> $worked['id']
-
The backticks (`) are like normal single quotes (') for table and column names - they are for identifiers. locked is a mysql keyword (if i remember correctly), thus breaking your query. See more here: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
-
"SELECT `locked` FROM `forumtutorial_posts` WHERE `postid` = '{$id}'"
-
I've got to be honest with you, I looked at your other thread and this one. Your code is really hard to read through, and you're not providing a lot of background information on what is supposed to happen, how it happens, etc. Take it as constructive criticism, but you have a lot of inefficient code.
-
Yeah, that's what I would do - of course don't forget to filter it (possibly use an array/switch to check to see if the action is acceptable)
-
Okay - after putting another item in my cart (apparently it emptied itself) and: I'm pretty sure the action=?GETVARS is browser dependent - some will run it, others wont (can anybody confirm this?)
-
Hopefully you're still fixing it,
-
<?php $action = ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET['action']))?$_GET['action']:''; $action = ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action']))?$_POST['action']:''; ?> Wouldn't that overwrite itself? If you had a GET var, but not a POST, action would be set to "" @ OP, I go to http://www.fhsgsa.org/dw2/cart.php?action=update However get the errors:
-
Look into Apache's modrewrite http://www.workingwith.me.uk/articles/scripting/mod_rewrite
-
Why not just use a hidden field?
-
It's not like you see a billion of them a day
-
<?php $path = dirname(__FILE__); include $path.$_SERVER['PHP_SELF'].'.txt.'; ?> Should work.
-
if($EnemyRand=="4"); shouldn't have a semicolon
-
Please help solve "Playlist Parse Create" script error.
Philip replied to djsolin's topic in PHP Coding Help
Well, as PHP states - chosen.txt is not found, which is why it cant read/see end of file. -
Good point. xtopolis' is going to be the best way, it'll take more work, but it'll be worth it in the long run (view patterns, history, etc)
-
[SOLVED] Finding the average from adding multiple entries from db
Philip replied to djfox's topic in PHP Coding Help
Agreed, I would use the AS, it makes things a lot easier -
Yeah, you can do it with PHP/MySQL. The easiest would probably be using sessions - when they login, start a counter session... each time they submit a new form, increment the session variable. On logout, just email the user's name, and the session variable. The other way would be a little more complicated, using MySQL. If you want to know that way, let me know and I can try to setup an example.
-
[SOLVED] Finding the average from adding multiple entries from db
Philip replied to djfox's topic in PHP Coding Help
You still need to call mysql_fetch_assoc (or array) -
size="32 value = " Missing a " on the <input> Also, if that doesn't work, Find: <body> Replace: <body> print_r($row); That'll show to make sure you're pulling the right col names + if there is a value or not
-
[SOLVED] i have a table in php and i want to highligh every other row
Philip replied to jeger003's topic in PHP Coding Help
I'm just following ngreenwood6 today Just optimizing the code above, same principles. <?php $color = '#000000'; // define color first while($LogF = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['id']."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['date']."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".urldecode($LogF['title'])."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['price']."</font></td>"; echo "<td bgcolor='$color' > <font size='2'>".$LogF['duration']."</font></td>"; echo "</tr>"; // Of course you could shorthand the following: // Or even put it in array to get multiple colors. if($color == '#000000') { $color = '#94FF79'; } else { $color = '#000000'; } } ?> Edit: forgot to define color before the loop Also, ngreenwood - on "$count = 1" you're missing a semicolon, but otherwise it would work -
Or, if you wanted to keep all your data, like me and become an e-packrat. A query would become (no DELETE query required): SELECT * FROM `table` ORDER BY `id` DESC LIMIT 100 You wouldn't lose any data - but if your point is to save space, ngreenwood6 is pretty much correct... I would just change it to: <?php $query = "SELECT * FROM table"; $results = mysql_query($query); $num_rows = mysql_num_rows($results); if($num_rows == 100) { //put delete query here (only deletes if 100 rows were found) } //put insert query here (always inserts) ?>
-
I dunno, I was hoping there was another way than to do a subquery on each value I needed to check - but I guess not. I just see a subquery as being a resource hog for some reason, even though it's probably not
-
Both are possible.
-
Given that the file is an UPDATE to the others, yes, your programmer would be able to leave the others alone (if coded correctly) However, if the products in the file are NEW (and not updates), then the VendorPrice or InventoryLevels would remain at NULL until you, or another query overwrote that.