Jump to content

Maverickb7

Members
  • Posts

    112
  • Joined

  • Last visited

    Never

Everything posted by Maverickb7

  1. Alright. I won't need to change this variables what so ever. I'm using them within a settings file to display common things like Site Name, Site URL, Site PATH, Table names, and that kinda stuff. None of that will ever have to be modifed unless done so from the settings file itself. So I'm guessing from the sound of it this is exactly what I need and the perfect thing to do the job I want. Would you not agree?
  2. btw... you wouldn't happen to have a link to a page on php.net that tells me about using $GLOBALS[''] would you?
  3. Thanks. I think you may have helped me by showing the define code. Any suggestions on how not to use it?
  4. Hello. You've probably seen me around asking question before so bear with me because I'm learning as I go along. I have the following files company.php (contains code that displays and sorts companies) company_functions.php (contains functions used within company.php) global_settings.php (contains variables used throughout the site alot) Within global_settings.php I have database information like the names of tables and such. now instead of adding the table name everytime i run a sql query I wanna just be able to add a variable that I can change the value of at any time. On the first line of company.php i require global_settings.php and then the line after I require company_functions.php. I'm trying to use the variables assigned within global_settings.php within functions in company_functions.php but for some reason it doesn't work. I even tried including global_settings.php at the top of company_functions.php. Does anyone know what I'm doing wrong?
  5. I've come across a problem and I wanted to see what everyone would suggest. I'm trying to add an item to my database through a form and have been successful. But if I retry to add say: $location = "The Location's going somewhere"; with this: $query = "INSERT INTO my_details VALUES ('$id','$name','$location)"; it gives me an error because of the single quote character. I was wondering how I could get the code to ignore it. Can I just escape it with / and if so.. hot would I go about adding/removing that from the string because its brought to the query?
  6. this is how i'm adding the genre numbers as one field in the database. I know there is an easy way.. but i'm still learning so I haven't found it. if ($_POST['check_1'] == 1) { $check1 = $_POST['check_1'].","; } if ($_POST['check_2'] == 2) { $check2 = $_POST['check_2'].","; } if ($_POST['check_3'] == 3) { $check3 = $_POST['check_3'].","; } if ($_POST['check_4'] == 4) { $check4 = $_POST['check_4'].","; } if ($_POST['check_5'] == 5) { $check5 = $_POST['check_5'].","; } if ($_POST['check_6'] == 6) { $check6 = $_POST['check_6'].","; } if ($_POST['check_7'] == 7) { $check7 = $_POST['check_7'].","; } if ($_POST['check_8'] == { $check8 = $_POST['check_8'].","; } if ($_POST['check_9'] == 9) { $check9 = $_POST['check_9'].","; } if ($_POST['check_10'] == 10) { $check10 = $_POST['check_10'].","; } if ($_POST['check_11'] == 11) { $check11 = $_POST['check_11'].","; } if ($_POST['check_12'] == 12) { $check12 = $_POST['check_12'].","; } if ($_POST['check_13'] == 13) { $check13 = $_POST['check_13'].","; } $genre = $check1.$check2.$check3.$check4.$check5.$check6.$check7.$check8.$check9.$check10.$check11.$check12.$check13;
  7. alright.. you've problem seen me around here asking for help before as this is the place I always run to for help. I've been spending alot of time trying to learn PHP as I'm trying to develop my own personal CMS. I have a lot complete but I'm still having some trouble coming up with ideas on storing certain types of data. Let me give you an example. Let's say I wanted to run a video game website. The CMS would grab a list of genre's from a database and display them as checkboxes within a page on the site (where admins add games). Now some games are going to belong to more then one genre (ex. action/adventure) and i'm wondering how easy it would be to have a group of check box data added to one field within a table row. Perhaps each one seperated by a comma. Now, I don't think I'd have much trouble making that happen. What i'm wondering is how I would use that information on the page that edits the game details. For example, I put a game down as action, adventure and then add it to the database. It would then be added as "Action, Adventure" without the qoutes. Now when I pull that info on a page created for editing how would i check off the check boxes that have been selected. I've been dealing with code for hours and my mind is kinda fried so any help would be appreciated. OH and if anyone has an easier way to complete what I'm doing please point me in the right direction. Thanks in advance guys!! hope you can help. Sorry bout grammar and spelling. It's late here.
  8. Thank you frost. I'll give that a try. =)
  9. Hello, I was wondering if someone could help me out. I've been using the below code. SELECT * FROM game_details WHERE gpub = \"$cid\" & gpid=\"9\" ORDER BY gname Basically I'm trying to specific to things after WHERE. It seemed to be working the way I thought it would until I tried using different numbers with gpid. If the value is set to 1 it will display all results with 1. But if I set it to 9 it does not display the results and is blank even though there are suppose to be results for 9. Anyone know what I'm doing wrong?
  10. Works beautiful mjdamato, thanks so much! Just curious... it's not importent but how come this doesn't work? if ($sort == "#") { $WHERE = "WHERE SUBSTR(cname, 1, 1) IN ('0','1','2','3','4','5','6','7','8','9')"; } else { $WHERE = "WHERE cname LIKE '$sort%'"; } $q = "SELECT * FROM `company_details` $WHERE ORDER BY `cname` ASC"; I'm trying to get it to allow me to use detail.php?sort=# and have it display all the numeric results but that doesn't seems to work. Any ideas?
  11. doesn't work. I used the code you provided and it doesn't change anything. I put a number as $sort and it shows me every item in the table. Any ideas?
  12. Arg... I've been looking for a solution for hours now. Could someone give me a hand?
  13. so I would use the following: if ($sort = #) { $q = 'SELECT * ' . ' FROM `company_details` ' . ' WHERE SUBSTR(cname, 1, 1) IN (0,1,2,3,4,5,6,7,8,9)' . ' ORDER BY `cname` ASC' } else { $q = 'SELECT * ' . ' FROM `company_details` ' . ' WHERE `cname` LIKE \'' . $sort . '%\'' . ' ORDER BY `cname` ASC'; } Basically what I'm doing is receiving information from the url. detail.php?sort=a <-- like that. With that it will list all results starting with A. I'm trying to have it display all numeric results if # is inputed where A was. Would this code do that for me.. if not how would I change it to work?
  14. I was wondering if someone could help me. What would I have to put within the $sort variable to have that request display all rows starting with a number? right now I have to put 1,2,3,4,5,6,7,8,9 seperate. Anyway I can include it all in one variable that would work below? $q = 'SELECT * ' . ' FROM `company_details` ' . ' WHERE `cname` LIKE \'' . $sort . '%\'' . ' ORDER BY `cname` ASC'; $r = mysql_query($q);
  15. It's been a few hours with no response. Does anyone know of another way to do what I want perhaps?
  16. Well, I have to leave for a couple of hours so hopefully when I return someone was able to offer their help. I'm kinda stuck on this even though its a pretty simple task. If you could help I would be really grateful.
  17. let's say I do what klitscher suggested and used his code. How would I tell the sql statement to grab all rows that start with a numeric vale? I want to type sort.php?letter=# and have it display all numeric results. Can anyone show me how to do this?
  18. Alright, I understand how it works and what it does. But could you point me in the right direction. I'm having trouble using # to display all numeric results. =( how would I use that with the sql line?
  19. I would like to list all files within a directory that end with .jpg and .gif. I have the below code at the moment and would appreciate if someone could help me out. Thanks! <?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "$file\n"; } } closedir($handle); } ?>
  20. I'll give your code a try. I actually coded something already using CURL like the above user suggested. After doing some research I managed to put together some code that works PERFECt. Thanks everyone!
  21. Alright i'm trying to get my host to enable url_fopen but until then I still have to find a work around. I'm searching for these terms on google and I'm not coming up with many helpful examples. What would I search for using google? Sorry if I'm coming off as a n00b, just trying to get my head in this stuff.
  22. Alright. I understand they have lots of examples but I don't see anything that shows me how to obtain the page title. The word "title" doesn't even show up on that page.
×
×
  • 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.