-
Posts
1,008 -
Joined
-
Last visited
Everything posted by spiderwell
-
im working on this one a bit more first, but that said i might have 2 solutions in the end, using the arrays again on teh second, depends how much i procrastinate on this instead ofdoing my own stuff, lol
-
ok so i have ended up using a switch statement dispite everything i said before. it sort of works, only I cant get the file open mode right. text file: 1,1 php file: <?php $counthandle=fopen("file.txt","r+"); //w+ indicates read and write and empty file contents upon writing, rather than appending which r+ would do(this is where I am getting stuck) $getcurrent=fread($counthandle,filesize("file.txt")); echo $getcurrent; switch ($getcurrent){ case "1,1": //redirect to lp1,offer1 fwrite($counthandle,"1,2"); break; case "1,2": //redirect to lp1,offer2 fwrite($counthandle,"2,1"); break; case "2,1": //redirect to lp2,offer1 fwrite($counthandle,"2,2"); break; case "2,2": //redirect to lp2,offer2 fwrite($counthandle,"1,1"); break; default://incase nothing in file or out of specified ranges //redirect to lp1,offer1 fwrite($counthandle,"1,2"); break; } fclose($counthandle); ?> only the script is appending on the end, and not overwriting, if i open in w+ mode it hangs on the file size bit . This is because I am trying to only open the file object once, you could easily re work this to just open file, read, close. open file, write, close
-
even though I have my own challenges to deal with, why are other peoples more fun to resolve! will post a script for you shortly (i hope )
-
i think i am getting more confused does the user input something on page 2 in the text area that determines the extra rows in page 3? relaying what I said earlier, and as from your 1st post you can trigger a js function by echoing it into the page via php, and even pass variables to it like this $passinginfo = $_POST['textarea']; echo "<script type='text/javascript'>functionName(" . $passinginfo . ");</script>"; but the jscript will only , as wildteen states, affect the compiled html page, and not affect the php but if you know in javascript how many extra rows to echo, why not just do that in php?
-
did i inner join the wrong way round? I will admit its one of my weaker points :'(
-
if your host has mysql they might well have something in a cpanel. and failing anything in the cpanel, phpmyadmin is a very simple install. without a database you can still do it I think then a combination arrays and textfile for storing the current offer and page will do the job just as well though. you should be able to read and write to a file in one object and use that to get current page/offer array, as well as updating it for the next user to hit the site. then from there just pull the info from the other arrays storing the pages and offers. way I see it only one thing changes and thats the page/offer combo so thats the only thing that needs to be in a text file. obvioulsy afte ra month a set of new offers might be available but just change that manually as and when. databases are awesome btw, they are essentially textfiles too, but with a very good supporting set of functions and operations e.g. SQL language of some sort, which allows excellent colation and manipulation of data.
-
you want to select all from video and inner join category on to that table where blah blah. then you have one record set with only the categorys listed in the video table and not a full list of categorys do you know enough sql to do that?
-
hey what! why else did god invent the interwebz
-
You can use PHP to include or not include javascript functions in a compiled page, as I have done that and the OP code does just that, but as wildteen states, actually calling them from one language to another cannot be done if you are basing part 3 on $_POST data from part 2, to create the form, you shuoldn't need JS at all, as all the info you need to create the form 'should' be available in php and be executeable that way. posting code of the forms so far would help out a lot
-
an html table? does the js execute after all the php stuff is done because your example should work then when page is pushed to client as i did something similar once attaching a ckedit js object to a textarea
-
special characters not displaying on ajax update
spiderwell replied to spiderwell's topic in Javascript Help
-
is the title in $header? or any of the php variables you have? substr() should sort that out easily enough. If you dont have 'control 'of the title, you might have use javscript to amend it client side directly in the iframe, but that sounds like a bitch to me you might get more knowledgeable people on the facebook developers page who know this?
-
javascript is almost always executed client side, and php is executed serverside. so what are you trying to achieve in the javascript? can it not be done in php?
-
you can use the gd() object for image manipulation to get the width and height, personally i would use a dynamic thumbnail script (that someone else wrote since theres plenty of them) to display the image to any size/proportion i chose. it would look something like <img src="thumbnailscript.php?file=picture.jpg&width=100&height=200"> passing the info to the php to spit out the image how you want it or use javascript to resize it client side, but of course that relies on javascript to be turned on (who even turns it off anyway I ask myself!!)
-
google had plenty for me: http://www.google.co.uk/search?hl=en&q=friends+list+database+php&meta= as above really, have a table called friends, and note I haven't given this much thought, with a userid | friendid | status | columns. Only problem i would see is if obama added osama, obama would be the userid and osama would be friendid, whereas if it was osama adding first it would be reverse. This might cause other issues when checking if someone is already a friend on not, depending on who added who first. add me as a friend once you have done it
-
I'd like to hope your book doesn't have errors like that in it! i'd ask for my money back if it did!
-
arrays cannot be passed like this, so no point even trying, not really a good practice. try serialize the array and pass that, then un serialize
-
change this while ($result = mysql_fetch_array($result,MYSQL_ASSOC)) { to this while ($row= mysql_fetch_array($result)) {
-
is the page rotation and offer rotation to work per user or for all users i.e dave arrives at your site and gets page1, offer 1 then pete arrives and gets page2 offer 1.... or should he also get page1,offer1 if its global, dave refreshes the page and gets page2 offer1, or since pete had that page, would dave then get page1 offer2? and how long does the rotation last? as a session variable (only while visitor is on site), a cookiee (can be months) or put it all another way, does each visitor get to see every offer in rotation, or just chance what rotation is when they arrive. I guess thats the difference between global and specific roation if that makes anysense. only the code solution would be quite different with your current code, you can certainly make it cleaner, as you could store all the info on 1 text file for starters. I think arrays might be a good solution if you cant use a database. $currentinfo = array("page"=>1,"offer"=>1); $pages = array(1=>"lp1.php",2=>"lp2.php",3=>"lp3.php"); $offers = array( $offer1= array("offer"=>"UGG Shoes","link"=>"offer1.php"),$offer2 = array("offer"=>"iphone 4","link"=>"offer2.php"),$offer3 = ("offer"=>"karma sutra dvd","link"=>"offer3.php") ); essentially you would update the $currentinfo array to hold current landing page and , and from that derive the page and offer needed. it is easily expandable in this format too. The current infoarray could be held in the session variable if its to be per user, otherwise you need to keep it somewhere where it gets updated by any users (i.e in a text file/database)
-
the 3rd page of code from wildteen does it, just change it to pass the data to the $text variable for your email instead foreach($_SESSION['step1_data'] as $field => $value) { if($field != 'step1_submit') echo "<p><b>$field</b> = $value</p>"; }
-
preg_match ("/^[A-Za-z0-9\ ]+$/", $theinput );
-
that form is , as i suspected, only getting data from the $_POST array, and not including the stored data in the session object, you need to add that part to it.
-
post up the page that sends the email so we can see how you are trying to send the info..
-
i was looking at this last night, and have an idea for an answer i will get back to you in a few hours, few errands to run first
-
get a specfic user details from mysql database using php?
spiderwell replied to jgkgopi's topic in PHP Coding Help
"SELECT `post`, `content` from `table` where `name` = ' " . $_POST['textfield'] . ";";