Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
Get rid of that last comma, right before the WHERE clause. Other than that your syntax looks correct. Are you echoing out $sql to ensure you have the correct values? Are you using or die(msyql_error()) at the end of your query execution? If these don't work we need all the relevant code...
-
$result2 will just give you the resource ID for the query, I think you want: (if there are 1 or more rows returned) if(mysql_num_rows($result2) >= 0)
-
Class Design- objects/classes inside classes- Critique my idea
Maq replied to JoeBuntu's topic in PHP Coding Help
I think creating classes for HTML tables is kind of a waste of time unless you have a specific one that you need to use a lot but not for general purpose. It would take just as much effort, even less, to use regular HTML table tags, rather than create all these objects and call all these methods. Maybe I'm not thinking dynamically enough but I can't see an advantage in creating classes for each row... Creating HTML template for certain pages is a good idea, but that's entirely different than OO tables. Maybe someone else can give you more positive feedback on this -
Does it always INSERT into normals? Have you echoed out $p? What is the value of it? Where is your link that brings you to this page?
-
Most of the web applications such as Joomla and OSCommerce are open source, so you can customize and style them as you please. Depending on your knowledge, it could take a long time to make your own customized, secure, reliable, robust etc... web application such as a shopping cart with all the nice features. Because there is no real answer. It's whatever you want to do. IMO, if you're asking this question then you probably want to use a pre-built CMS, shopping cart, or whatever you need and customize it.
-
And how are we supposed to do that with the lack of information? Like everyone else said, we need to know what you're doing. Obviously you're doing a Backup-Report of something but what? We also need to know how you're doing it. I have run into this problem before and had to use sort of a recursive method solve this problem. Please provide code so we can further assist you.
-
You're assigning rather than comparing: if($_SESSION['SESS_LOGGEDIN'] = TRUE){ should be: if($_SESSION['SESS_LOGGEDIN'] == TRUE){
-
Your code is hard to follow, due to the poor formatting. Are you sure there should be more than 1 row returning? Have you tried running it in something like PHPMyAdmin to ensure there is more than 1 row? Or put it in a while loop and display one of the rows to see how many there are? mysql_num_rows doesn't lie... There is no way we can really tell why or how many rows it should be returning. Maybe someone else has a better idea.
-
I don't have an environment to test this in right now but it should work... session_start(); if (isset($_GET['idpub'])) { //Record passed on the query string for deletion //NOTE: You will need to correct this code for the right field names include('connections.php'); $idpub = mysql_real_escape_string($_GET['idpub']); //Get the name and abbreviation for the form $sql = "SELECT name, abbreviation FROM publisher WHERE idpub=$idpub"; $result = mysql_query($sql) or die(mysql_error()); $record = mysql_fetch_assoc($result); $name = $record['name']; $abbreviation = $record['abbreviation']; } else { //No id passed on GET or POST - error handling echo "No record selected"; //exit(); } //User confirmed the deletion if (isset($_POST['submitYes'])) { include('connections.php'); $idpub = mysql_real_escape_string($_POST['idpub']); $sql = "DELETE FROM publisher WHERE idpub='$idpub'"; $result = mysql_query($sql) or die(mysql_error()); mysql_free_result($result); echo "The record has been deleted."; } //User selected NOT to delete. Redirect somewhere else if (isset($_POST['submitNo'])) { echo "The record has NOT been deleted."; } ?> </pre> <table border="1" cellpadding="0" cellspacing="0" width="500"> You have selected '' for deletion. Do you want to continue with the delete action?   </table> <br><b
-
name="idpub"> Line 68 should be:
-
I think you're fine with that solution, the 0 and 1 "boolean" method is a common practice. Although I'm still confused as to what exactly you're trying to accomplish, so I cannot confirm this is a permanent solution. Sorry :-\
-
A syntax highlighter should have picked that up. What editor do you use? Anyway, mark as [sOLVED] if that's the case.
-
Either read some more or look around phpfreaks for some other related threads. There are plenty of "PHP game developers" around.
-
Ding Ding Ding! We have a winner! You need to use the POST method instead of the GET method. $idpub = $_POST['idpub']; Is your form tag on this page... something like ??? </pre> <form method="POST" action="<?php%20echo%20%24_SERVER%5B'PHP_SELF'%5D;%20?>"><
-
One of the best debugging tools is echo. You should echo out your variables and queries to ensure they hold the correct values. For example: echo $idpub . " "; $sql = "DELETE FROM publisher WHERE idpub=$idpub"; echo $sql; $result = mysql_query($sql) or die(mysql_error()); In the query ($sql) you should also surround $idpub with single quotes if the datatype is NOT and integer. And finally use or die(msyql_error()) for any possible query errors, if there are it should output a descriptive error message to the browser.
-
There's probably a much easier way to do this but my head hurts from work: $halo_count = 0; while($rows = mysql_fetch_array($query)) { if($rows['game_name'] == 'halo') { $count++; } if($count > 1 && $rows['game_name'] == 'halo') { break; } else { ?> } } ?>
-
You're missing a ' here: </pre> <table class="'product-table_1"></ Should be: </pre> <table class="'product-table_1'"></
-
Awesome, mark as [sOLVED] if that's the case.
-
This doesn't make any sense to me. Do you mean 0.5 = 30mins?
-
You have to do the string sanitizing (htmlspecialcharacters and mysql_real_escape_string) after you replace the ereg_replace(). The reason for this is because the htmlspecialcharacters will convert '&' to &
-
Use str_replace().
-
If you're referring to casting the variables to strings, you don't have to. PHP is a very loosely typed language, can I ask what your reason is for this?
-
This is not a "Regex" question, which is where you posted it, and why you have no replies, I will get a mod to move it, stay put!
-
You guys are so smart!
-
Lol, that would make things a lot easier Do this: $response = (in_array($q, $a)) ? "Okay" : "Not Okay"; echo $response;