brianjw Posted May 12, 2008 Share Posted May 12, 2008 While the topic title is vague, I will describe with detail what I want. I am trying to make a wishlist page on my site which would pull the list from the database with the item name and a source (source meaning the URL where this could be bought or read about in more detail). Anyway, I have read many of the faq's/docs you guys have here as well as many docs at mysql and the php site and I am just not advanced enough to get into it. How could I basically make a layout like this with this (only the actual data will be in the database not the title: My Wishlist 1. Item 1 [click here] 2. Item 2 [click here] Except the [click here] would be the url that is placed in the source field. Then, the reason I am doing this... An add form. The page would be of course blocked by htaccess unless password is entered (which I know how to do myself), all I need is help getting a form up that would add another item through the internet. It would look like. My Wishlist - Add Item Item Name: [_______________________] Item URL: [http://_____________________] [submit] [ & ] being form values and ___ being text boxes. Of course I can make this page on my own except for getting it to submit it to mysql and adding it. For a noob like me, could someone please explain in detail or give me a sample code that is exactly what I am trying to do. Thank you so much. :) brianjw Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted May 12, 2008 Share Posted May 12, 2008 Re: Need help with creating a php/mysql powered page. I've made a little cart befor :) Well what i understood is you want some thing that displays the item's, then when they click it they can view a description of it? But then at the bottom a submit to add it to the database so it add's it to there cart right? If so: <?php include("connect.php"); if($_POST['item_id']) { $id = abs(@intval($_POST['item_id'])); $fetch_data = mysql_query("SELECT * FROM tablename WHERE row_ID=".$id) or die(mysql_error()); $soc = mysql_fetch_assoc($fetch_data); mysql_query("INSERT INTO cart (itm_ID,itm_NAME,itm_PRICE,itm_BUYER) VALUES('".$id."','".$soc['row_NAME']."','".$soc['row_PRICE']."','".$me['my_id']."')") or die(mysql_error()); echo 'Item added successfuly to your cart.'; exit; } $item = abs(@intval($_GET['XID'])); if(!$item) { echo '<h3>Viewing all item\'s</h3> <table border="1" cellspacing="0" width="75%"> <tr> <th background="black"><font color="white">My Wishlist</font></th> </tr> <tr>'; $fetch_data = mysql_query("SELECT * FROM tablename"); while($soc = mysql_fetch_assoc($fetch_data)) { echo '<td>'.$soc['row_NAME'].' [Add Item]</td><tr>'; } echo ' </tr> </table>'; } else { $fetch_data = mysql_query("SELECT * FROM tablename WHERE row_ID=".$item) or die(mysql_error()); $soc = mysql_fetch_assoc($fetch_data); if(mysql_num_rows($fetch_data) == 0) { echo 'Item ID does not exist. Please go back and click on an existing item.'; exit; } else { echo '<h3>Viewing item [b]'.$soc['row_NAME'].'[/b] [b]Item Name:[/b] '.$soc['row_NAME'].' [b]Item URL:[/b] '.$soc['row_URL'].' <form action="'.$_SERVER['PHP_SELF'].'" method="post"> <input type="hidden" name="item_id" value="'.$soc['row_ID'].'"> <input type="submit" value="Add Item"> </form>'; } } ?> Quote Link to comment Share on other sites More sharing options...
Floydian Posted May 13, 2008 Share Posted May 13, 2008 Re: Need help with creating a php/mysql powered page. What database are you using? The PHP version you are using may be helpful as well. Can you connect to your database at all? I.e., do you have code ready to go that connects you to the database or do you need that as well? Quote Link to comment Share on other sites More sharing options...
brianjw Posted May 24, 2008 Author Share Posted May 24, 2008 Re: Need help with creating a php/mysql powered page. killah, I am not looking for a shopping cart script. I am looking for something that only I can add a list of things to. Floydian, All of my php info, mysql info, and additional info can be retrieved from http://www.gamerzgarage.com/phpinfo.php No, I don't have the code that connects me to the database. I need it as well. :) Thanks, brianjw (sorry for taking long to respond) Quote Link to comment Share on other sites More sharing options...
Floydian Posted May 24, 2008 Share Posted May 24, 2008 Re: Need help with creating a php/mysql powered page. I'm just going to post this real quick and come back and edit the post with an answer for you. Very IMPORTANT: It is highly recommended that you take down that php info page, and don't put it up again. That script contains way more info than you want people to get their hands on. I'm sure others will confirm this. ######################################## <?php define("HOST", "localhost"); define("USER", "user_name"); define("PASS", "my_password"); define("DB", "database_database"); $con = mysql_connect(HOST, USER, PASS); mysql_select_db(DB); $q_data = mysql_query('select column_a from table_1 where column_b = some_value'); $my_data = null; while($row = mysql_fetch_array($q_data)) { $my_data .= <<<EOT Somthing to click on [url="blah.php?action=foo&id={$row['column_a'];}"]here.[/url] EOT; } echo <<<EOT <h2>Let's see if we got anything from the database...</h2> $my_data <hr> Did anything appear from the database? EOT; ?> Quote Link to comment Share on other sites More sharing options...
Guest Anonymous Posted May 24, 2008 Share Posted May 24, 2008 Re: Need help with creating a php/mysql powered page. Agreed Floydian - I generally have one on all sites but password protected for safety. There is waaaaaay to much info in the phpinfo script that can be used to attack a server. Quote Link to comment Share on other sites More sharing options...
brianjw Posted May 25, 2008 Author Share Posted May 25, 2008 Re: Need help with creating a php/mysql powered page. Floydian, I have deleted the phpinfo.php file for now but when I get some free time on my hands I will put it back up and password protect it. :) As for the code you provided ~ Could you please provide me with a query that would get me started with adding items to the list? Thanks. :) Also, could you provide me with a page that I can submit items to the list (outside of the database) so basically I can add an item with a url by going to add.php which will of course be password protected. Quote Link to comment Share on other sites More sharing options...
Floydian Posted May 25, 2008 Share Posted May 25, 2008 Re: Need help with creating a php/mysql powered page. Basically, you want me to write the entire script for you? I charge for that sort of thing. I gave you something to go on. If you're not willing to do anything with it, then you'll have to part with some cash. Quote Link to comment Share on other sites More sharing options...
brianjw Posted May 26, 2008 Author Share Posted May 26, 2008 Re: Need help with creating a php/mysql powered page. Ok, well thanks for what you gave me. I'll go look for some free support... Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted May 27, 2008 Share Posted May 27, 2008 Re: Need help with creating a php/mysql powered page. Its not free support you want.. Its free Work.....Good luck finding that....Why do people want someone to code something for them...And they dont want to pay for it....You do realize the code don't just appear on the comuter.. We USE OUR TIME to make stuff like this.. Why the HELL shouldnt you get paid for it? DO YOU go to work and say hey you know what I'm going to work for free today..... well hell no......... Quote Link to comment Share on other sites More sharing options...
brianjw Posted May 27, 2008 Author Share Posted May 27, 2008 Re: Need help with creating a php/mysql powered page. Calm down... I know places where they do complimentary things for free so I am going to stop by there. :) Quote Link to comment Share on other sites More sharing options...
Floydian Posted May 27, 2008 Share Posted May 27, 2008 Re: Need help with creating a php/mysql powered page. My post was complimentary :S I guess my efforts weren't appreciated. Care to let us know where one would go to get free work done? I have tens of thousands of lines of code I would love to nickel and dime off of them.... Quote Link to comment Share on other sites More sharing options...
brianjw Posted May 27, 2008 Author Share Posted May 27, 2008 Re: Need help with creating a php/mysql powered page. Floydian, your code was helpful but I am not smart enough to turn it into something I want and am too poor to pay... Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted June 3, 2008 Share Posted June 3, 2008 Re: Need help with creating a php/mysql powered page. And back to the phpinfo() page...You've still yet to password protect/delete that.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.