Jump to content

ale8oneboy

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by ale8oneboy

  1. Something to think about when deciding to use functions or not - Ask yourself: "Am I about to cut and paste a block of code?" The response should be: "Then maybe I should turn this block of code into a function."
  2. This code: if(@$_POST['state'] == $value) { echo "selected='selected' "; } Is correct/works in comparing the current array entry to what's selected. Logically you want to insert that code on the <option> tag. Break this line: echo "\n<option value='$state_province' /> "; Into: echo "\n<option value='$state_province' "; //insert the code to check the selected value here echo "/> "; How's that work for ya?
  3. The max execute time would come into play as well as other PHP ini variables. Take a look at: max_post_size and upload_max_filesize
  4. If there not a space in the file name then that's your issue. Remove the space on line where it creates the path. The way the script is now it's adding a space. Try changing: $path = '/inc ' .$page .".php"; to $path = '/inc' .$page .".php";
  5. On this line: $path = '/inc ' .$page .".php"; I notice there is a space after "/inc". Does the file to be included have a space in the file name? Is the file in the root of your application? Try to echo out what the path it's concatenating is and verify that the path is correct. It may be just as simple as that space causing issues.
  6. The code you have provided would display the qty, an * and then the price. I believe you're looking for this: echo '<td>'.($_SESSION['itemqty'][$key] * $_SESSION['itemprice'][$key]).'</td>'; The difference is this code would compute the sub-total then display it. Hope that helps.
  7. I could see this working fine. I do something very similar internally on some of my projects. However I would recommend your remote login script to pass some kind of shared security token to your app. It may be a token that changed on a fairly regular bases to detour someone else from authenticating themselves with a known user. Another food for thought would be to restrict by IP which clients can send remote login info. Anyone else have any thoughts to add?
  8. Take a look at PHP Simple HTML DOM Parser. http://simplehtmldom.sourceforge.net/
  9. If I'm understanding you correctly there are two tables in the database one 'library' and one 'files'. If the library table contains an id referencing a file in the file table you could try joining the two tables together in a query and use the first part of your script for everything you need. You wouldn't have to browse the directory using the second part of your script. Pseudo example: $sql = "SELECT * FROM library l JOIN files F ON L.FILE_ID = F.FILE_ID"; Just a thought.
  10. You could try grouping by property_id, beds, baths to get a unique set of matching properties/bed/bath list. I created a test environment with similar tables. Here's the query I used: SELECT * FROM `properties` p LEFT JOIN floorplans f ON p.property_id = f.property_id WHERE p.zip_code = '77075' AND f.beds = 3 and f.baths = 2 GROUP BY p.property_id, f.beds, f.baths Is this what you're looking for?
  11. In my experience I've had to use the alias on the wild card too. Try: SELECT products.product_id_number AS product_id, products.* FROM products
  12. The simple answer to your problem is not to add that field in your update query. All the server knows to do with that statement is update the field to whatever you give it. If you're creating this query in a script (PHP for example), you could control what fields get updated based on if variable is NULL or Empty. Example: If you wanted to leave the data unchanged for the field metaDesc. You would change or have your script change the query to the following. UPDATE cms SET metaName = '$metaKey' WHERE rowID = 1 I would look into writing the script to check to see if the variables are empty before including them in the query. You could build it to where it dynamically builds the query before executing it.
  13. Take a look at the MySQL's min() function. It will return what ever is the lowest value in the field you tell it to use. http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_min
  14. Sorry, I must have not been paying attention this morning. You could create two select queries and use a UNION, then group by the ID field. This would give you a unique list of all ids from both tables match or non-matching. Example: SELECT * FROM ( (SELECT ID FROM TABLE_A) AS A UNION (SELECT ID FROM TABLE_B) AS B ) GROUP BY ID May not be the best query. But it would work.
  15. Can you give us an example of how you would like to display the output as an result?
  16. Pardon me if I don't completely understand what you're trying to do. But if you're trying to add a submit button for when the select box is returned, would you just append the html to $agentdrop in the true condition? Or maybe you could check for to see if the function returns a select box and write a condition where it displays a submit button. Just some food for thought. Possible Easy Solution: after: $agentdrop.='</select>'; add: $agentdrop .= "<input type='submit' value='Submit'>";
  17. Are you looking to not allow links/urls at all or just eliminate html tags? You could try 'strip_tags' function after form submit. Take a look at: http://php.net/manual/en/function.strip-tags.php
  18. In the past I've set a limit on the number of rows per page ($max_rows_per_page) and tracked the row count in a counter variable ($row_id). When the row count mod'd by the max pages per sheet ($row_id % $max_rows_per_page = 0), I broke the table and put in a page break (using CSS). Then started the table again. Like above, this was for an internal app. But it worked nicely with Firefox. Just a thought to add. page break example echo "<p style='page-break-after: always;display:inline;'> </p>";
  19. I agree with ttocskcaj. You'll want to backup your database before making these changes. The query given will make the `story_id` the primary key as long as the field is completely unique through out the table. You may consider backing up your database again (separate file) to pick up your new table structure in your backup. Having the `story_id` being primary should be all the indexing you need for this table and queries.
  20. I don't claim to be an index expert. But from what I can tell the bulk of your queries involve the `story_id` field. Is this field a primary key? If so then you're already indexing this column as a primary key. You may think about creating an index on the `userc` field. But if you're not having performance issues, I would not be concerned with creating indexes at this point. A little more information would be helpful. What kind of performance issues are you hitting? Which queries seem the slowest? How fast will the insertion rate increase as your application picks up more users? Anyone else have any thoughts to my recommendations?
  21. I think I see what's going on here. You'll want to break your html output up just a little bit. This should be before your loop: echo "<table border=\"1\" cellpadding=\"1\" cellspacing=\"0\">"; This should be in your loop. echo "<tr><td><img src=\"".$info['picture']."\" border=\"0\" /></td></tr>"; This should be after your loop. echo "</table>"; Otherwise it will display the same image three times for each row in the database. Make sense?
  22. Try: $query = "SELECT * FROM directory WHERE merchant = '$var'";
  23. Try: "$image.$extension" Instead of $image.$extension Wouldn't $image.$extension just join the two variables as a string?
  24. Does passchanger() reside in the same file or in an included file? If it's in an included file you might want to check that file.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.