PHP - Pass Data Noob :(
Basically I am trying to make a list of items which I have put into an sql database. When I click on an item in the list, I want a "generic" page loaded, with the items description. Im having alot of trouble with getting this generic page to work. Heres what Ive done so far.
The page with shows the list http://pastebin.com/PE8FkyYQ http://pastebin.com/GiCpV5AH The generic page with the items description. http://pastebin.com/HFnSfqN4 http://pastebin.com/C0zsHpZY If anyone can help me solve this problem, ill be greatly in there debt! Similar TutorialsHello. I am just beginning to teach myself the basics of php. I am learning from books and video tutorials etc. I have come across a problem that I just can't work out, I'm sure it is very simple. Two files, movie1.php and moviesite.php, movie1.php looks like this: Code: [Select] <?php session_start(); $_SESSION['username'] = "Joe12345"; $_SESSION['authuser'] = 1; ?> <html> <head> <title>Find My Movie!</title> </head> <body> <?php $myfavmovie = urlencode("The Life of Brian"); echo "<a href='moviesite.php?favmovie=$myfavmovie'>"; echo "click here to see information about my favourite movie!"; echo "</a>" ?> </body> </html> OK? You see the '$_SESSION['username'] = "Joe12345";', this is my specific problem. This should be echoed into the next page, moviesite.php which you can see below: Code: [Select] <?php session_start(); //check to see if the user has logged in with a valid password if ($_SESSION['authuser'] != 0) { echo "sorry, but you don't have permission to view this page"; exit(); } ?> <html> <head> <title>My Movie Site - <?php echo $_REQUEST['favmovie']; ?></title> </head> <body> <?php echo "Welcome to our site, "; echo $_SESSION['username']; echo "! <br>"; echo "My favourite movie is "; echo $_REQUEST['favmovie']; echo "<br>"; $movierate = 5; echo "My movie rating for this movie is "; echo $movierate; ?> </body> </html> OK? 'echo $_SESSION['username'];' does not echo the username. Everything else seems to be ok. This is an example I have been working on from the book 'Beginning PHP, MySQL and Apache Web Development'. I hope someone can help. The username 'Joe12345' is not carried to the next page. It is just blank. Many Thanks for all and any assistance people can give me. Hi ! I need to pass a lot of variables using GET, and many of them are related, so I was thinking in two options: 1) Pass them as array: Code: [Select] example.php?categories[]=cat1&categories[]=cat2 2) Pass them in a single parameter, and split it in PHP (a custom and simpler serializer) Code: [Select] example.php?categories=cat1|cat2 What do you think is better? (or maybe there is a 3rd option...) The second method seems more readable and short, the first easier to construct and maybe faster because we don't need to "unserialize". But I'm looking for better reasons. I'm thinking in a possible advantage of the first method over the second for SEO, because if Google is smart enough to understand that categories[] are all the same, then can understand that: Code: [Select] example.php?categories[]=cat1&categories[]=cat2is equal to: Code: [Select] example.php?categories[]=cat2&categories[]=cat1I think that is more difficult for Google to understand that with: Code: [Select] example.php?categories=cat1|cat2and Code: [Select] example.php?categories=cat2|cat1 Regards!! Enrique. Hi, I'm trying to fetch rows of data from a mysqli table and display them in the browser in categories. I have the while loop working fine, but I want to break the results down into categories, instead of one big list sorted by a field using ORDER BY. So for example, let's say I have a database table containing people's names, email address, phone numbers, etc. and I want to display them in the browser in separate tables by the city in which they live (each city name would be a h1 or h2 tag) and the appropriate rows would be displayed under each heading, sorted by the person's name. I can do it by using multiple while loops, separating each city into it's own array and then repeating my html table code a bunch of times, but I know there has to be a much cleaner way. Can anyone point me in the right direction? Thanks! Hello, How can I get the id in the search bar into the viewuser.php file ... <?php foreach($myObjectMap as $key => $item): ?> <tr> <td> <a href="viewuser.php?id=<?PHP echo $item->ID; ?>"> <?PHP echo $item->UserName; ?> </td> ...
This has probably been asked a bunch of times , but : I only recently started to self learn PHP , and this small project i am making is quite a challange for me. The scripts below are not realy writen by me , but i wished to tie them together to get a fully working code. What is suppose to happen is : In the form i wish to put a special button that puts extra input fields in the form. After the form is submited ,with whatever amount of feilds in it, the data goes to a processing.php file that sorts all the info gathered and finaly sends all this data formated in to the last file that will be inluded in the index.php. i already have the code for increcing the amount of inputs but the problem is , all inputs have the same names. Coz of that i get a mess. What i need is each input to have a unique name or id , that way the processing file would receive different names(id's) with different values(what ever is writen in the inputs by users). for example: I have 2 enitial fields displayed on form.html , i click the button "add new" 5 times and add 5 more input fields. All this data must be sent to a process.php and on the output write all of this information formated in the last file in a row that will be displayed in the index by useing <?include("blablabla.php");?> The input increment is done by a java script. the problem is sending data with unique id(name) and receiving it. The form file : <?include("header.php");?> <?$i = 1; ?> <script type="text/javascript"> function validate(frm) { var ele = frm.elements['feedurl[]']; if (! ele.length) { alert(ele.value); } for(var i=0; i<ele.length; i++) { alert(ele[i].value); } return true; } function add_feed() { var div1 = document.createElement('div'); // Get template data div1.innerHTML = document.getElementById('newlinktpl').innerHTML; // append to our form, so that template data //become part of form document.getElementById('newlink').appendChild(div1); } var ct = 1; function new_link() { ct++; var div1 = document.createElement('div'); div1.id = ct; // link to delete extended form elements var delLink = '<div style="text-align:right;margin-right:65px"><a href="javascript:delIt('+ ct +')">Del</a></div>'; div1.innerHTML = document.getElementById('newlinktpl').innerHTML + delLink; document.getElementById('newlink').appendChild(div1); } // function to delete the newly added set of elements function delIt(eleId) { d = document; var ele = d.getElementById(eleId); var parentEle = d.getElementById('newlink'); parentEle.removeChild(ele); } </script> <TABLE> <style> #newlink {width:600px} </style> <form action='sendorder.php' method='post'> <div id="newlink"> <div> <table align="center" border=0> <TR><TD><B>Product:</B> </TD><TD><input type=text name=prodname1 value="<?=$_GET['prodname1'];?>"> </TD> <TD><B>Price:</B> </TD><TD><input type=text name=price1 value="<?=$_GET['price1'].$curency;?>"><b>%</b></TD></TR> </table> </div> </div> <p> <br> <input type="submit" name="submit1"> <input type="reset" name="reset1"> </p> <p id="addnew"></p> <FORM> <INPUT type="button" value="Add New" name="button2" onClick="javascript:new_link()"> </FORM> </form> <!-- Template --> <div id="newlinktpl" style="display:none"> <div> <table border=0> <TR><TD><B>Product:</B> </TD><TD><input type=text name=<?$_POST[++$i];?> value="<?$_GET[$i];?>"> </TD> <TD><B>Price:</B> </TD><TD><input type=text name=<?$_POST [++$i];?> value="<?$_GET[$i].$curency;?>"> </TD></TR> </form> </TABLE> <?include("footer.php");?> in the code above i tryed to make the programm POST the numbers in the name increcing it by 1. But when i click submit i get offset error. The processing file : <? $timestamp = strftime("%d-%m-%Y %H:%M:%S %Y"); // for later use (ignore it) $i =1; #################################################################################### if(($_POST['prodname']!="")&&($_POST['price']!="")){ ############################################################ $writetocsv = $_POST['prodname1'] . "," . $_POST['price1']"%" <BR> . $_POST[$i] . $_POST[$i]; $fp = fopen("data/data.csv", "a"); fwrite ($fp,$writetocsv); fclose ($fp); echo "<script>alert('Data sent.')</script>"; } else{ echo "<script>alert('Error! Please fill the form!')</script>"; } echo "<script>location.replace('index.php')</script>"; ?> Perhaps someone knows a easyer way , since i am not sure how to make stuff due to the lack of knowlage in php. I also tryed arrays but , as said before , too tough when you are a noob Please help. Please tell me how can i do it ??
Hello all, I can't get the data store in the $ART_ID variable to pass into the database. The original $Artisan variable is set up like this: 1. Artisan Name. So the explode is taking just the number. If I put an echo after the explode and the $ART_ID variable it outputs the correct information but it doesn't store in the database as that data. The query is in correct order too. Thanks in advance. $CType_Type = $_REQUEST["CTYPE_Type"]; $Artisan = $_REQUEST['Artisan']; $Quantity = $_POST['Quantity']; $HAnswer1 = $_POST["HAnswer1"]; $HAnswer2 = $_POST["HAnswer2"]; $HAnswer3 = $_POST["HAnswer3"]; $HAnswer4 = $_POST["HAnswer4"]; $break = explode(".", $Artisan); $ART_ID = $break[0]; if(!$Quantity) { die('Quantity field is empty. Please enter the quantity of handicrafts made.'); } else { $ctypeQuery = mysql_query("SELECT CTYPE_ID FROM CraftType WHERE CTYPE_Type = '".$CType_Type."'"); while($row = mysql_fetch_array($ctypeQuery)) { $CTYPE_ID = $row["CTYPE_ID"]; $sql = ("INSERT INTO Handicraft VALUES (`HANDI_ID`, '".$Quantity."', 'NULL', '".$CTYPE_ID."', '".$ART_ID."', 'NULL', '1')"); if(!mysql_query($sql)) { die('Error inserting Handicraft Type into table: ' . mysql_error()); } else { -----data in this section doesn't affect the rest of the code---- } } } Hi, Is there a way to send extracted information from one (local) MySQL db, via PHP, to an external web form - having that web form submit that info to it's connected MySQL db without human interaction? Basically, I need to automate a process using the $_GET function to that form but not sure if there is a way to accomplish this from just connecting to the web form (itself); bypassing direct MySQL access which is the later option. Any input appreciated - thanks! I need to pass captured data, basically, a list of email addresses that are being read from a CSV file and (1st) saved to an local database, then sent over to an external source via URL string. I have everything working except - script opens the file, read and validates all emails in the specified column, and saves to local db. ISSUE: after validating then INSERTING the data into local mySQL db, I need to then pass each piece of data to an external source via URL string. Example: www.domain.com?email={$new_email} I was initially think to just add the URL in a header function but, I'm not sure if the HEADER() function the right method to pass all of the data - during the loop - via the URL string. For example, if the CSV file contain 500 emails: Q: how can I continue that loop until the last email read, passing each up to the external source via the URL string? I'm not sure if using the HEADER() function at the end of the script - but within the loop - will interate and send each capture email via that URL string. Can anyone advise a possible solution to this? thanks I work with a large codebase and I have this situation come up fairly often:
the legacy class has large objects such as:
$design->motor->dimensions->a; $design->motor->dimensions->bd; $design->specifications->weight; $design->data->height; //etcWhen I create a new class, that class sometimes operates on the specific data, so say: class MyClass { public function compute($weight, $height, $a) { //stuff } } //and I call this for example as such: (new MyClass())->compute($design->specifications->weight, $design->data->height, $design->motor->dimensions->a);CONS: Potential issue: if design specs change and I need to change things parameters in "compute" function, I need to "re-key" the variables I pass to the function, and adjust things accordinly in MyClass as wel. PROS: only the exact data is being passed, and this data can come from anywhere it is viable, so in effect the function is fairly well separated, I think. Alternative option for me is to pass the entire design object, i.e class MyClass { public function compute(&$design) //can also be done via DI through a setter or constructor. { print $design->specifications->weight; print ($design->data->height + $design->motor->dimensions->a); //stuff } } (new MyClass())->compute($design);PROS: In this case when things change internally in which variables are needed and how things are computed, I only need to change the code in compute function of the class itself. CONS: MyClass now needs to be aware of how $design object is constructed. When it comes to this parameter passing, and Dependency Injection like this in general, does Computer Science advocate a preference on this issue? Do I pass the entire object, or do I pass only the bits and pieces I need? I'm trying to get a simple table to display and am not sure how to make it happen. Table will have just 2 columns. A TIME and an EVENT. What I want to have happen is for the first row to show the TIME and next to that, the EVENT. If a TIME has more than one event going I want the next row to show an empty first cell and then the second event below the first. If I set up the loop the only way I know how (so far) it would also output the TIME value again and again as many times as there were events for that same time. For example what I don't want is: 9:15 Sunday School 9:15 Nursery Available What I do want is: 9:15 Sunday School Nursery Available Thanks. Please bear with me. In an html file there is an <!-- BEGIN poll --> ..... <!-- END poll --> I need to draw a separation hr between all rows escept the first one. I believe I need a counter. Please show me how to do this. Thank you. I had a developer working on stuff for my site and he died before he got to the uploader. I am not a programmer. I can alter a few basic things, but this is beyond me. I found this basic uploader that I could edit the locations, file types, etc. It is missing one area of functionality that I need, the ability to define how many upload fields through a variable (which is set in an earlier form). So for example $fields = "3" then 3 upload fields appear with descriptions set by variables (for examples sake...front and then upload area, back and then upload area, misc. and upload area). I know this might not make a lot of sense. If you need any clarification please contact me. Any help would be much appreciated! So I'm trying to learn PHP so that I can work with the SteamAPI.
I have previous coding experience (C, Java) and I'm uncertian on why my script isn't working.
API: https://github.com/a...teamweb-php-api
Error:
Parse error: syntax error, unexpected '[' in index.php on line 51
Line 51:
$parameters = ['key' => STEAM_WEB_API_KEY];From what I've understood, the script is trying to create an array called "parameters" and inside it's trying to create a variable called "key" which is going to hold the constant "STEAM_WEB_API_KEY". This constant is suppose to be loaded from a file called "steamwebapi_config.php" which looks like the following: <?php /** * Steam Web PHP API */ const STEAM_WEB_API_KEY = 'your steam api key that is given by vavle';I didn't attach my actual key in the script above for obvious reasons. I have no idea how to fix this issue nor what is casuing it. Again, I'm not experienced with PHP and I'd appreciate any help you guys can give me! Thanks to anyone who helps. Hi there I'm new in the php coding and I just don't undestand most of all database settings etc... so I have something to do but I don't know exactly how so here is the thing: The disciplines are separated into modules. A module contains lectures and more than 1 group that gets exercises and practical training. The necessary number of the hours of a module is formed of the sum of the hours of lectures, exercises and practical training, multiplied by the numbers of the groups. The site has to give the possibility of: - Writing into new modules and lecturers. - Defining the number of groups (lectures, exercises, practical training) for a module. - Appropriating of groups and lecturers. - Visualizing the list of modules/lecturers. if you can help with advices or whatever you can I'll be very thankfull well, here's my problem, im new to php, i currently working on this mini online shop the picture will explain it well, i've managed to create the receipt per shop but i cant do the receipt of the overall shopping here is my code: <html> <head> <title>My Shop 4</title> <script type="text/javascript"> function gohome() { window.open("receipt.php","_self"); } function changeshop() { window.open("home.html","_self"); } </script> </head> <body> <form action="" method="POST"> <input type="checkbox" name="prod1" id="prod1"\ value=10>Product 1 10.00php<br> <input type="checkbox" name="prod2" id="prod2"\ value=20>Product 2 20.00php<br> <input type="checkbox" name="prod3" id="prod3"\ value=30>Product 3 30.00php<br> <input type="checkbox" name="prod4" id="prod4"\ value=40>Product 4 40.00php<br> <input type="checkbox" name="prod5" id="prod5"\ value=50>Product 5 50.00php<br> <input type="submit" name="submit" id="submit" value="Buy!!"><br> <?php $det = 4; require("../Labphp/lab.php"); shop($det); ?> </form> </body> </html> and here's the php part <?php $total = 0; $total3 = 0; $total4 = 0; $recent ="HAHAHA"; global $total,$total3,$total4,$recent; ?> <?php function shop($num) { $value1 = $_POST['prod1']; $value2 = $_POST['prod2']; $value3 = $_POST['prod3']; $value4 = $_POST['prod4']; $value5 = $_POST['prod5']; $sum=0; $sum = $value1 + $value2 + $value3 + $value4 + $value5; if($sum!=0) { echo "Selected Products<br>"; echo "Product Name       Price<br>"; if($value1==true) { echo "Product 1              10.php<br>"; } if($value2==true) { echo "Product 2              20.php<br>"; } if($value3==true) { echo "Product 3              30.php<br>"; } if($value4==true) { echo "Product 4              40.php<br>"; } if($value5==true) { echo "Product 5              50.php<br>"; } echo "Total                     $sum php<br>"; if($num==4) { $total4=$sum; $recent.="Shop 4                  $total4 php<br>"; } else if($num==3) { $total3=$sum; $recent.="Shop 3                  $total3 php<br>"; } $total = $total4 + $total3; echo "$recent              $total"; echo "<input type='button' name='go' id='go' value='Choose Another Shop' onclick='javascript:changeshop();'>"; echo "<input type='button' name='end' id='end' value='End Shopping' onclick='javascript:gohome();'>"; } } function getshopping() { return $recent; } ?> the receipt code <?php require("../Labphp/lab.php"); ?> <html> <head> <title>Official Receipt</title> </head> <body <?php echo $_REQUEST["'$recent'"]; ?> </body> </html> Hello, I'm new to this forum, and I have just spend half an hour typing out my question as complete as possible, and just before I wanted to hit the "Post" button, I pressed "why not?" out of curiousity @ Read the rules before you post! We will NOT edit/delete your content (why not?)! so I lost everything I wrote. Anyway. I'll shortly retype it all: I'm a Dutch student - therefore my English isn't that good, I'm sorry for that - and for school, I have to make a website. It has to include a CMS system, a search-box, a contactform, Google Analytics and Google Maps. In the meantime, I don't even seem to be able to write 3 php lines properly. When I tried to, and uploaded my work, my site (www.amstel-webdesign.nl) told me: Parse error: syntax error, unexpected T_STRING in /home/amstelwd/domains/amstel-webdesign.nl/public_html/index.php on line 119 Hereunder, please find the source: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Amstel webdesign & graphics</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <!-- header start --> <div id="header"> <ul> <li><a href="">Homepage</a></li> <li><a href="">Over ons</a></li> <li><a href="">Webdesign</a></li> <li><a href="">Graphics</a></li> <li><a href="">Prijzen</a></li> <li><a href="">Contact</a></li> </ul> </div> <!-- header end --> <!-- body start --> <div id="body"> <div class="left"> <a href="#" title="Over ons"><img src="images/hobby_profession.png" alt="Onze hobby is ons beroep geworden..." width="780" height="305" border="0" /></a><br class="spacer" /> <br class="spacer" /> <h2><span>Home</span>page</h2><br /> <br /> <p>Is het niet ieders droom om van je hobby je werk te maken? Wij, webdesigners van Amstelland, zijn erin geslaagd die droom waar te maken. Als kleine jongetjes vonden wij het al leuk om met computers te spelen, inmiddels doen wij dat als werk. Maar dat betekent niet dat wij ons werk niet serieus nemen. Juist omdat wij zo van webdesign houden, zullen wij er alles aan doen om ervoor te zorgen dat het u aan niets ontbreekt. Wij zijn toegewijde professionals die plezier hebben in hun werk. En dat merkt u ook! Wij zijn niet vies van zware opdrachten of lastige problemen, we zien het als een uitdaging... </p> <p>Heeft u al een website, dan kunt u deze gratis door ons laten testen. Wij testen op een aantal essentiële onderdelen van uw site. U krijgt snel een kort, duidelijk en uiteraard vrijblijvend rapport, met daarin eventueel te verbeteren punten. Daarna heeft u de mogelijkheid om ons de punten in kwestie te laten verbeteren, en de website te laten onderhouden, tegen een scherp tarief. Heeft u interesse in een dergelijke test, maakt u dan een afspraak met ons. Als u het contactformulier invult, te vinden onder de menuknop <a href="">contact</a>, dan nemen wij zo spoedig mogelijk contact met u op. <br /> </p> </div> <div class="right"> <h2><span>Diensten</span></h2><br /> <ul> <li><a href="#">Webdesign </a></li> <li><a href="#">Consultancy </a></li> <li><a href="#">Onderhoud </a></li> <li><a href="#">CMS </a></li> <li><a href="#">SEO </a></li> <li><a href="#">Webshop ontwikkeling </a></li> <li><a href="#">Contactformulier ontwikkeling </a></li> <li><a href="#">Zoekfunctie ontwikkeling </a></li> <li><a href="#">Google Analytics </a></li> <li><a href="#">Google Maps </a></li> <li><a href="#">Mobiel </a></li> <li><a href="#">Huisstijl ontwikkeling </a></li> <li><a href="#">Drukwerk </a></li> <li><a href="#">Vertalingen </a></li> </ul> <br /><br /> <form method="post" action="#" name="search" class="search"> <label><span>Zoek</span>functie</label> <br class="spacer" /> <input name="search" type="text" id="search" /> <a href="#" title="Advance search">Geavanceerd zoeken</a><input name="" type="image" src="images/search_btn.gif" title="Search" class="searchBtn"/> </form> <form method="post" action="#" name="login" class="login"> <h2><span>Log-</span>in</h2><br class="spacer" /> <label>Naam</label><br class="spacer" /> <input name="name" type="text" id="name" /><br class="spacer" /> <label>Wachtwoord</label><br class="spacer" /> <input name="password" type="password" id="password" /><br class="spacer" /> <input name="" type="image" src="images/login_btn.gif" title="Login" class="loginBtn" /> </form><br class="spacer" /> </div> <br class="spacer" /></div> <!-- body end --> <!-- footer start --> <div id="footer"> <div class="footer"> <div id="nav_left"> <a href="" title="Home">Home</a> <br /> <a href="" title="Over ons">Over ons</a> <br /> <a href="" title="Webdesign">Webdesign</a> <br /> <a href="" title="Graphics">Graphics</a> <br /> <a href="" title="Prijzen">Prijzen</a> <br /> <a href="" title="Contact">Contact</a> <br class="spacer" /> </div> <div id="nav_center"> <a href="">Webdesign</a> <br /> <a href="">Consultancy</a> <br /> <a href="">Onderhoud</a> <br /> <a href="" title="Content Management System">CMS</a> <br /> <a href="" title="Search Engine Optimization / Zoekmachine Optimalisatie">SEO</a> <br /> <a href="">Webshop ontwikkeling</a> </div> <div id="nav_right"> <a href="">Google Analytics</a> <br /> <a href="">Google Maps</a> <br /> <a href="">Mobiel</a> <br /> <a href="">Huisstijl ontwikkeling</a> <br /> <a href="">Drukwerk</a> <br /> <a href="">Vertalingen</a> </div> </div> </div> <!-- footer end --> </body> </html> The php part is marked in red (I hope)... And line 119 is echo ("Amstel_webdesign_graphics" date ("Y")) Could someone please tell me what I'm doing wrong, and what it's all supposed to be? Before I uploaded my index.html with the php lines, my piece was xhtml 1.0 strict and had a valid CSS. I left part of the footer out, so if that created any mistakes (a </div> too many or not enough or such), it probably has nothing to do with the php fail. Thanks so much in advance. Anthony Hi all i have a silly noob question.... When i directly query my database with the following i get the exact result i want....... Code: [Select] SELECT * FROM posts WHERE postTopic=3 AND postSubject=business; However when i try this using the following PHP....... $sql = "SELECT * FROM posts WHERE postTopic =" . mysql_real_escape_string($_GET['id']) . "AND postSubject='" . $_SESSION[forum] . "'"; I get no result I also get the correct results from $sql = "SELECT * FROM posts WHERE postTopic =" . mysql_real_escape_string($_GET['id']) . "; and $sql = "SELECT * FROM posts WHERE postSubject='" . $_SESSION[forum] . "'"; mysql_real_escape_string($_GET['id']) is an integer and $_SESSION[forum] is a string. I know this has something to do with the manner in which the query is passed with the AND and the string but i can't for the life of my work out where i am going wrong. Thanks for any help. I get to errors below and cannot figure out what im doign wrong i've tryed diffrent ways and have even rewritten this couple times (#1error) not sure how to re query and echo out the array?? (#2error) gives me error on line 14 if i echo anything past (echo $row['name']."|user1:". $row['user1']. "|user2:". $row['user2']. ->this Code: [Select] <?php $conn = mysql_connect("localhost", "root", ""); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); } if (!mysql_select_db("register_db")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $result = mysql_query("SELECT * FROM register_vote WHERE name = '{$_POST['user']}'"); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } =========================(#1error)========================================== //THIS IS THE CODE I'M HAVING ISSUES WITH if (mysql_num_rows($result) == 0) { mysql_query("INSERT INTO register_vote (name) VALUES ('$_POST[user]')"); //need it to the query new results after insert //then // echo $row['name']."|user1:". $row['user1']. "|user2:". $row['user2']. "|user3:". $row['user3']; }================================================= (#2error)=================================== while ($row = mysql_fetch_array($result)) { echo $row['name']."|user1:". $row['user1']. "|user2:". $row['user2']. "|user3:". $row['user3']; } //when I put anything past $row['user2']. it gives me error on line 14 mysql_free_result($result); ?> Ok so heres the deal, my friend wrote this for me, hes currently unavailable and i messed it up a bit. http://pastebin.com/k937xDve < there is the code. all i did is add the Code: [Select] target="name" onclick="window.open('http://www.web-hosting-service.org/green-certified.php?greensite=.$domain.','name','height=255,width=250,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no'); return false;" bit. and now i get the error Parse error: syntax error, unexpected T_STRING in seal-generator.php |