-
Select from 2 tables - help
So is there no way in a single SQL query to select the products once, and select all of the options to match? It just always feels a bit messy having loops within loops to me.
-
Select from 2 tables - help
I always seem to struggle to get my head around selecting from multiple tables whether or not to select from both, join or union etc... I have a table of products and a table of options for each product. The options table has the product id (prodictid) in each row. I am trying to output each product with a list of it's relevant options next to each one. This is what I have: $q = mysql_query(" SELECT *, SUBSTRING_INDEX(description, ' ', 30) AS description FROM products p, priceoptions o WHERE p.product_id = o.productid AND p.catid = '1' AND p.active = '1' "); while($row=mysql_fetch_array($q)){ output stuff here... } Problem is, if I use the while loop, I can get my array of options, but it will also output the product name, description as many times as there are options rather than just once per product. I suppose I could just set the variables in the while loop and omit all duplicates but it seems a bit crazy to extract the same details several times if it's only needed once. What is the best way to do this efficiently?
-
-
Nested list php while loop problem
THat seems to have done the trick! Thanks!
-
Nested list php while loop problem
I have some rows in my DB and each has a ['subpage'] value of either 0 or 1 to indicate if it is a main page(0) or subpage(1) and they are ordered (column 'item order') so the parents are above their children e.g. 1 home (0) 2 about(0) 3 about-sub(1) 4 about-another-sub(1) 5 page(0) 6 page-sub1(1) 7 contact(0) What would be the best way to loop through these as a nested ul? I would have personally preferred to give each sub page a parent id but the person that created the CMS just did it like this so I am stuck with it!
-
Problem with jquery append
Both of those give exactly the same results again.
-
Problem with jquery append
That gets me: <tr><td></td></tr><input typ...etc... Confused!!!
-
Problem with jquery append
I have 3 input elements set as variables. When I do this: $("#cart > tbody:last").append($("<tr></tr>"), input, input2, input3); the output is (shortened inputs for quickness): <tr></tr><input typ... /><input typ... /><input typ... /> instead of: <tr><td><input typ... /><input typ... /><input typ... /></td></tr> Any ideas?
-
Run a php file in background?
Sussed it! Needed to set CURLOPT_REFERER
-
Run a php file in background?
I suppose I want it to run as though it were a cron file - would there be another way to do this? exec() perhaps?
-
Run a php file in background?
That is an option...but that would mean I would have to build some mailing list software too. This is just to automatically subscribe emails to the mailing list software within the hosting account. Not getting any errors with curl - it just doesn't seem to work with this particular sign-up. As if it needs to run in the browser and redirect before it will update or something
-
Run a php file in background?
I am trying to make a form automatically submit details to some mailing list software during a paypal IPN script. Basically, the form as standalone html, once filled in with an email address and submitted, will add that email to the mailing list. If I create a file and use header("Location: http://url/of/mailinglist/?email=$email"); then run the page it works...but of course brings me to the default success page. I just want this to happen on it's own during processing of other info in the paypal IPN verification script....so it processes payment, sends out emails, updates database and also runs that page. I can't use header() because it is ignored by the fact that the IPN takes the visitor back to the paypal payment complete page on the paypal site. I can't include it...that just wouldn't work. I have tried using curl to post the form details but that doesn't seem to work either. All I want is for that url to run somewhere on it's own, out of sight, but be triggered from my ipn script!!! Any ideas??!?
-
-
-
-
Facebook feed on my site
if(isset($json_output['data'][$i]['picture'])){ echo '<br /><img src="'.$json_output['data'][$i]['picture'].'" alt="" />'; }
-
Facebook feed on my site
You will have to output that URL in an img tag
-
Facebook feed on my site
you are running the code in between script tags instead of php tags. get rid of these: <script></script> and do this instead... <?php //code here ?>
-
-
Facebook feed on my site
Just lump the whole lot together and put it in your page where you want the feed to appear. Then style it to suit the rest of your page. Don't forget to add your own codes in and app id where stated (in uppercase) otherwise it won't work. When you are working on it, it may be best to change the cache time to 1 so that you can see your code changes in real time. Then when you are happy with it, set it to cache for as long as you like.