nortksi
Members-
Posts
20 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
nortksi's Achievements
Newbie (1/5)
0
Reputation
-
Just thought, Should I try passing the variables in the URL with the form? Is that even possible? Thanks, Mark.
-
Hi ZulfadlyAshBurn, sorry for the late reply, I've been out of the office over the weekend. I am assuming that the variables have been set as I can display the data being retrieved from my 'businesses' table in the MySQL database. For example; I can display the company name and postcode that these variables hold. Could it be something to do with where abouts in my code these variables are placed? I am in a difficult position because I am signed into a non-disclosure agreement with my employers so I can not reveal to much of my code. Kind regards, Mark.
-
Hi. Yes an error is reported: Notice: Undefined variable: ii in /content/Hosting/p/l/web/eventresults.php on line 25 Notice: Undefined variable: sr in /content/Hosting/p/lweb/eventresults.php on line 25 Notice: Undefined variable: ii in /content/Hosting/p/l/web/eventresults.php on line 26 Notice: Undefined variable: sr in /content/Hosting/p/l/web/eventresults.php on line 26 These lines are: $Code = $sr[$ii]['postcode']; $Company = $sr[$ii]['company_name']; I hope this can shed some light Regards, Mark.
-
Hi ZulfadlyAshBurn, thanks so much for taking the time help me! I have implemented the changes you suggested. Unfortunately; it still does not work I have checked the variable and field names which all appear correct. Any other thoughts? Kind regards, Mark.
-
Ok, having reading up on the suggested material I have gave it a go. However; I am unable to get this working. This is what I have so far: HTML FILE: <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test.php", { method: 'post', postBody: '<?php $Company;?>'+$F('<?php $Company;?>')+'&<?php $Code;?>='+$F('<?php $Code;?>') onComplete: showResponse }); } function showResponse(req){ $('pr_likes').innerHTML= req.responseText; } </script> <body> <div class="pr_thumb"> <?php $Code = $sr[$ii]['postcode']; $Company = $sr[$ii]['company_name']; ?> <form id="test" onsubmit="return false;"> <input type="hidden" name="<?php $Company;?>" id="<?php $Company;?>" > <input type="hidden" name="<?php $Code;?>" id="<?php $Code;?>" > <input type="submit" value="submit" onClick="sendRequest()"> </form> </div> </body> TEST.PHP <?php $companyName=($_REQUEST['$Company']); $postCode=($_REQUEST['$Code']); // connect to the database mysql_connect("*****", "*****") or die(mysql_error()); mysql_select_db("******") or die(mysql_error()); mysql_query("UPDATE businesses SET number_likes = number_likes+1 WHERE company_name = '$companyName' AND postcode = '$postCode'"); ?> It is no doubt incorrect on so many levels. Any helpful pointers will be greatly appreciated Regards, Mark.
-
Thanks! I shall give it a read.
-
Hi voip03, thanks for your reply. Ah right, I'm afraid my knowledge of Ajax is even less than my knowledge of PHP. Just a quick note, I also need to add to the number of likes once the button has been pressed. Regards, Mark.
-
Hi guys, I am hoping someone can help me with this. I am pretty new to PHP and MySQL but I am learning all the time; however I have become stuck. I am developing a business directory and need to be able to let the user click a 'like' button which will then add to the total number of 'likes' for that business. At the moment I am able to retrieve all businesses and output them to the screen, the current number of likes is also displayed. The brief code for displaying th number of likes is: <div class="pr_likes"><?php echo $sr[$ii]['number_likes'];?> likes</div> <a href="#"><div class="pr_thumb"></div></a> Underneath the pr_likes class is a div that displays a roll over 'thumbs up' image. I realise that instead of this being a hyperlink it will most probably be a form? If possible I want it to add to the total number of 'likes' without leaving the current page as the retrieved businesses are returned randomly and I do not want to scramble the results. All help will be greatly appreciated. Kind regards, Mark.
-
Thanks for your reply guys! I tried cyberRobot's second suggestion and that worked a treat! Thanks again guys! Mark
-
Hi guys, may I request some help with a problem I'm having trying to pass results retrieved from a mySQL database as variables in a URL within a loop. At the moment the connection to the database and the query work fine and I can display these results to the screen. Now I want to be able to click on one of these results to query the database again. However the URL being created is: http://www.domainname.co.uk/script.php?event=Array[event_name]&town=middlesbrough As you can see the town is being passed fine but the event name is not. Below is my code: $results=@mysql_num_rows($rt); if ($results > 0) { for ($ii = 0; $ii < $results; $ii++){ $data = mysql_fetch_array($rt); $dr [] = $data; } } if ($results > 1) { $location = $postLoc; for ($ii = 0; $ii < $results; $ii++){ echo '<a href="script.php?'."event=$dr[$ii][event_name]&town=$location".'">'.$dr[$ii]['event_name'].'</a>';?><br /><?php } } I am just a novice so this is probably easily fixed, I would greatly appreciate any help offered. Kind regards, Mark.
-
OK I couldn't resist, I took my work home and tried removing one of the $nt=mysql_fetch_array($rt); and this did the trick! Thanks PFMaBiSmAd and everyone else for their help, much appreciated If you get time, PFMaBiSmAd, will you be able to explain why having 2 arrays would dicard the first row? Kind regards, Mark.
-
Thanks for you help guys, I finished work early today and wont be back in until Monday morning. I'll get onto your suggestions first thing monday morning and I'll post the results. Thx again guys. Mark.
-
Hi, OK I tried this, exactly the same result Thx Mark.
-
Hi. The first row is not empty. This has really confused me as I know 4 results have been retrieved from the database because I tested it by echoing $results which displayed 4. I have to be careful what I write on here as I'm signed into a non-disclosure agreement so I don't know how much of the code I can put on here. Kind regards, Mark.
-
Hi WebStyles, thanks for the reply, and tip. However; it still only displays 3 out of the 4 results, again it is the first result in the mySQL database that isn't being displayed. Regards, Mark.