-
Posts
3,372 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Muddy_Funster
-
Your going the right way, except for a couple of things: your timestamp value in the query string should be enclosed in single quotes; you should have error capture on your connection and query stings and you are using 2 queries where 1 would do. other than that looks spot on, It would be better if you would continue the verbose commenting aswell.
-
small search causing endless loop returning same result
Muddy_Funster replied to mullberrymae's topic in PHP Coding Help
Then only one record is being returned by the query, try tweeking your sql: $sql="SELECT id, fname, lname FROM obituaries WHERE (lname LIKE '%$keyword%') OR (fname LIKE '%$keyword%') ORDER BY id DESC"; -
You must wrap your $_SESSION['gatekeeper'] in single quotes as it is a string. Also, you'r or die statement should be against the mysql_query() NOT the mysql_fetch_array(). in addition it is better practice to assign the query text to a variable before running the mysql_query() against it. here: $sql = "SELECT * FROM user WHERE username = '$_SESSION[gatekeeper]'"; $query = mysql_query($sql) or die ('ERROR :<br>'.mysql_error().'<br><br>When Running<br><br>'.$sql); while ($row = mysql_fetch_array($query){ ... Also, try to avoid using SELECT *
-
nothing in the array at all? could you post up your new code with the update query in it?
-
Yeah, could you post the code from your login page please?
-
Try a print_r($getSelectQueue) to see what it's got in it.
-
Adding a new column with auto increment to an existing table
Muddy_Funster replied to wright67uk's topic in MySQL Help
you can't auto inc a varchar field! -
Assuming you kept the same variables, does this not work? while($getSelectQueue = mysql_fetch_assoc($sqlSelectQueue) $rank = $getSelectQueue['rank'];
-
small search causing endless loop returning same result
Muddy_Funster replied to mullberrymae's topic in PHP Coding Help
change while ($i < $num) { $id = mysql_result($results,$i,"id"); $fname = mysql_result($results,$i,"fname"); $lname = mysql_result($results,$i,"lname"); ?> <a href="view.php?id=<?php echo ($id); ?>"><?php echo($fname); ?> <?php echo($lname); ?></a> <?php } } to while ($row = mysql_fetch_assoc($result)) { $id = $row['id']; $fname = $row['fname']; $lname = $row['lname']; echo '<a href="view.php?id='.$id.'"><'.$fname.'> <'.$lname.'></a> '; } } Also, you could put some error capture in there to limit the loop to a count of, for example, 100. -
you have any more info other than "it no longer works"??
-
No, it should be on a totally new page - all by it's self. call it something like 'test_info.php' then point your browser at 'http://domain/directory/test_info.php' (that is assuming you didn't save the file in the web rout, if you did ignore the /directory part). Try that and let us know how you get on.
-
Get rid of those SELECT * and explicitly name the fields that you want back. You don't use SELECT * like that anyway. Also, could you post your table strcture up, I'm pretty sure you should be using a JOIN in this.
-
Cookies arn't ideal. Like javascript, they are required to be enabled at the client side, something you have no control over. Using a PHP Session as Kickstart has suggested would be better. Cookies are, ultimately, for the EU benefit, not the web servers (although it has become common for people to use them for evil). A lot of the additional information will be dependant on your hosting provider supporting it with their PHP install configuration. And be carefull about restricting by IP address aswell, I access sites from my home and my office, using (obviously) two totaly different IP's. Just stuff to think about. Follow what Kickstart said about Sessions and having a logins table and you will be starting in the right direction. Good luck
-
Could you post up your table structure please? This looks like it's headed at getting messy and we may need to re-evaluate your database before it gets much further.
-
Connecting a shopping cart to a Microsoft Access database
Muddy_Funster replied to gazfocus's topic in Microsoft SQL - MSSQL
I would dump access altogether (but then again I have a strong personal hatred for the program ). It's not going to be long before the database is taking ages to load, query and update. Access is bad. Just use the database that is running on the server for the information required. Export the access database to a csv file and import it into the database used by the shopping cart. Most shopping carts have pretty good customer management as well as obvious product management facilities. If there is anything clever being done in the Access database it should be easily replicated by custom PHP pages querying the cart database. Failing that, I suggest that your friend get MS SQL Server (2005/2008). The express edition should be free (although it has some limitations it should still be more capable than Access) which can then be linked vie ODBC (assuming that level of access is available on the server) to the cart database and synced using scheduled tasks. Just my thoughts. -
This is a little wrong... $sql = "select * from memberinfo where username='$username'"; $result = mysql_query($sql,$connect); $row = mysql_fetch_assoc($result); } if($row['username'] == $username && $row['pword'] == $pword && $row['actype'] == $actype) try something like this : $sql = "SELECT username, pword, actype FROM memberinfo WHERE username = '".$username."' AND pword = '".$pword."'"; $result = mysql_query($sql,$connect) or die ('Error :<br>'.mysql_error().'<br><br>When Running the following :<br><br>'.$sql); $row = mysql_fetch_assoc($result); } if(($row['username'] == $username) && ($row['pword'] == $pword) && ($row['actype'] == $actype))
-
Yeah, it's always best to get into the practice of securing your site early on. What I recomend is reading up on some examples (both here and other sources) of data sanitisation and the use of SALT with encription. And if you hit any other questions post up a new thread in the php section, there are some smokin' programs on this site, and if you give your post a relevent title you should get a quick response.
-
Hey, I am trying to plug into a third party database, and am having problems getting my CASE statement to work. I have been at this for a while now, even tried using a WITH and didn't get anywhere. Basicly I am looking for a result set that will ahve the "Comment" set to yes or no depending on if the sheetID is in both the Files table and the tbl_dialog table. Problem is, that while the CASE is outputing Yes and No appropriately for different sheetID's it is also causing 4700 records to be returned for each sheetID and taking an age to perform the querie. Hope someone can help, here's the SQL in it's latest incarnation: SELECT Files.SheetID, Files.PenName, Files.FileDate, Files.FileName, Users.UserName, Folders.FolderName, 'Comment' = CASE WHEN ((SELECT Files.sheetID) IN (SELECT Files.SheetID FROM dbo1.Files INNER JOIN dbo2.tbl_dialog ON (dbo1.Files.SheetID = dbo2.tbl_dialog.sheetID))) THEN 'Yes' ELSE 'No' END FROM dbo1.Files AS Files INNER JOIN dbo1.Sheet AS Sheet ON (Files.SheetID = Sheet.SheetID) LEFT JOIN dbo1.Pad AS Pads ON (Sheet.PadID = Pads.PadID) LEFT JOIN UserFolders AS Folders ON (Files.AssignedFolderID = Folders.FolderID) RIGHT JOIN dbo1.Users AS Users ON (Users.UserID = Folders.UserID) , dbo2.tbl_dialog WHERE Pads.PadPrefix = 'String' AND (FileStatus <> 1 AND Files.SheetID > 100000) GROUP BY Files.SheetID, Files.FileStatus, Files.PenName, Files.FileDate, Files.FileName, Users.UserName, Folders.FolderName, dbo2.tbl_dialog.sheetID ORDER BY Files.SheetID DESC Some data has been manipulated, but the structure is intact.
-
perhaps something like: SELECT color FROM table_colors WHERE color = 'green' OR color='red' OR color = 'blue' Although that's probably too simple, but I don't really get the question....
-
That's a problem. You should get all your PHP settings listed on the page. Also, you shouldn't use () with require - it's not a function.
-
try: $filename = $this->getMsisdn().".png"; if (!file_exists(sfConfig::get('sf_upload_dir') . '/rainbowcode/images/profilepics/'.$filename)) { $filein = "Rainbow-code-1_blck.jpg"; // $source = imagecreatefromjpeg($filein); imagejpeg($filein, $this->getMsisdn().'.jpg') }
-
using SELECT * opens holes in security, reduces scalability, wastes resources and generaly annoys the hell outa me . there is never any benifit to using SELECT * over explicitly named fields (even if you want all the fields) other than "it's less to type". Personaly I think that, if you don't want to type, you have the wrong hobby going on. Think about it - If you are going swimming, and your swimwear is in your bedroom, do you take the ENTIRE contents of your room (bed & PC included) with you to the pool and then find your swimwear after you get there, leaving all your other stuff just lying about? 'cource you don't, that would just be silly. That's basicly using a SELECT * on your room. you wouldn't do it in real life, you shouldn't do it in a database. Not sure about getting the time taken to show, I know it can be done, just don't know how.
-
ok, and is that the same reason that the values are not wrapped in single quotes as well?
-
Remove the word DISTINCT from the query and - ORDER BY postTime DESC. curious though - why are you trying to re-invent the wheel so to speek?