johnny_d. That was my other technique for the non-AJAX solution. Great minds think alike :)
dr4g 25 Junior Poster
dr4g 25 Junior Poster
dr4g 25 Junior Poster
dr4g 25 Junior Poster
johnny_d. That was my other technique for the non-AJAX solution. Great minds think alike :)
Cron jobs are your easiest solution.
Another method would be making 2 PHP scripts to bounce off of each other.
File 1: Run the target script wait 10 seconds and call File 2.
File 2: Run target scritpt wait 10 seconds call File 1.
It would be advisable to make a script take in a $_GET value to 'exit' the scripts.
So once you go to file 1: in your browser, it will create a continuous loop which will bounce form one file to the next. Until you type in this exit command.
IF you can post your existing code. we can help modify this with an additional dimension for storing the image information.
Which language is this in ?
Well are you going to design a for loop to loop through and output chars each time? or just call one function to do it. I think we all know which is the most appropriate.
Okay, well i'm referring to the fstream library. not the .h file, i was unaware there was a difference.
Thank u I am trying my best
What you need is a Web Server.. which will host websites.
Your looking to use PHP scripts, so yo'll also need a PHP server.
And configure both of them together.
To do this easily, assuming you're running a Windows Operating System. Download a program named WAMP (Windows; Apache, mySQL, PHP). Which you can download from
http://www.wampserver.com/en/
any help with WAMP, you can ask here, or better yet, theres numerous sites with WAMP forums available.
Drag..
not a problem. could you send me a private message please?.
Yes that's understood. What my point was. that. putc() outputs one character so if you wish to output words to the console, you'll need to LOOP for each character you wish to output. thus being very ineffective.
puts() would eradicate the need for looping altogether.
Theres absolutley nothing wrong with using the fstream library for handling Input/Output streaming.
>>but idk how to get the file and store it
but depends on whether you are writing a C or C++ program, which you failed to answer.
He did answer, he said he's using C++ and using the Linux Operating System.
jaepi, we don't have much information on specifically what your wanting to do and how to get this file.
Are you wanting to type in the file location and copy it to the current directory?.
Are you wanting to copy the file's contents, and write them to a file?
If you are going for the first option.
you can simply run a copy command using system() function to call the linux 'copy' command.
The second option you're looking to use "fstream"
which can be used by including. #include <fstream.h>
in your file.
You need to identify exactly HOW your wanting to get the file,
and HOW your going to store it.
If you have the methods we can give you the code for these methods.
Drag...
Andor is correct.
the puts() function takes a String (char array) as the parameter.
putc() would output 1 character only, and not really useful or effective in this case.
When you type characters into the console, its going to STDIN.
you're wanting to modify the character value coming from the keyboard.
There are Windows API functions available for this. off the top of my head i can't remember what they are. MSDN would be your best bet for this.
yes i gave you 'rep' :)
It's not about how famous you are, it's about knowledge, and helpfullness. :)
That would probably be an easier approach.
johy_d is right. Your problem could well lie within the htmlspecialchars() function.
Only way to identify this is.
Instead of putting the query directly into mysql_query().
Do.
$query = "SELECT * FROM table";
/* This will output your query then exit the script */.
echo $query; exit;
/* run query with mysql error functionallity */
$ret = mysql_query($query) or die(mysql_error());
NOTE: After observing your query, you'll need to remote the exit; or the "echo $query; exit;" So that execution can continue onto the mysql_query() function.
Identify what is working first, before trying to figure out what isnt working.
Any questions just ask.
omick16. PHP Server runs off of a web server, aka apache. If your accessing it locally, it can be accessed by 'localhost'. As far as i know, there isn't a function available to tell you the IP address of the machine your running.
Very true, if it's done privately, no1 benefits from that, and that's what forums are all about. building communities & discussing different methods and solutions together.
* Gives High 5 To w_3rabi *
Wow, wow Infarction calm down.
You're jumping the gun a little for these guys.
They're not ready for advanced error handling techniques.
They're just getting to grips with mySQL techniques.
Need to give them a chance to understand how things work, before you can introduce new techniques to them.
Keep plodding along guys, it will make more sense in time. ;)
That's extremley narrow minded w_3rabi.
There's a number of solutions available.
I give professional honest advice.
So i'm re-interating, that AJAX is the easiest solution to your problem.
Same applies to Lexid2002.
you're getting an error on fetch_assoc(), as theres a problem at the query stage.
This can be identified by doing the above code.. adding ' or die(mysql_error()); to the end of the line.
Once you have sorted the query, the mysql_fetch_assoc, will have a valid resource, and you'll not get this error.
Recap on above Post.
If your having an error with mysq_num_rows($res).
Basically you need to verify that your query worked ok.
Code for having error checking setup is.
$ret = mysql_query($query) or die(mysql_error());
This will output the error that is being caused at the query stage.
Ok. You're looking to go to W3Schools website and learn basic PHP skills.
This will teach you about how to use variables and output intormation.
This will also teach you about how to use _forms_.
Forms, will facilitate your needs for grabbing information from a form. and doing something with it.
Any more _specific_ PHP questions we can demystify the issue for you.
Drag...
Yep. Blank page = loop never being executed.
Anonymusius' post about the foreach() will probably be the most important thing, you (Clanham). to learn form these responses.
Good luck on your PHP adventure
Yes, AJAX is your solution.
You're looking to use the onChange() javascript function within your Drop-Down box.
Upon changing the value, you'll need to re-grab the information from the database.
AJAX will be the easiest solution to your problem.
What you _could_ do is..
say the XML element is <item>...
You could store all text before and including the <item> tag.
Then store all the text after and including the </item> tag.
Then you can do.
$string = $before . $value . $after;
realnsleo, if you have some existing code or a live problem. we can help you rectify your problem.
Please paste some code or a working example.
Drag..
seems like you got it working then. if you have any more questions, don't hesitate to post!
What you're wanting to do is use an ASSOCiative array.
Theres 2 methods of doing this.
mysql_fetch_array($rsQry, MYSQL_ASSOC);
or
mysql_fetch_assoc($rsQry);
/* init */
$arr = array(
"chapter1" => array(),
"chapter2" => array(),
"chapter3" => array()
);
$chapter1_amount = 4;
$chapter2_amount = 6;
$chapter3_amount = 8;
for($i = 1; $i <= $chapter1_amount; $i++)
array_push($arr['chapter1'], $i);
for($i = 1; $i <= $chapter2_amount; $i++)
array_push($arr['chapter2'], $i);
for($i = 1; $i <= $chapter3_amount; $i++)
array_push($arr['chapter3'], $i);
This theoretically works. It's 3am and i didnt compile it, but looks fine to me.
For manipulating the link acording to the dropdown list.
You'd need to call a javascript function to generate the link.
When you choose an option in the list, you'd call the javascript function to update the link.
/* HTML */
<select onChange="updateLink(this)">....</select>
/* JavaScript */
function updateLink(list) {
if(list.value='bleh')
link = "bleh";
......
return link;
}
Well, "justsaymayb". It's just like asking "how long is a piece of string?".
Since this is the PHP thread, you could develop something that gives more meaning to your uni/course, than just "a project".
Say you used a web based system, you could develop something with better functionallity, easier interface, more appealing look.
You'll get more points for innovation than just making a random project.
Regards,
Drag.
Another solution would be, instead of using a foreach() you could use a for() loop.
$arr = array("cat", "dog", "horse", "frog");
echo "<select name=dropdown_list><option value="bleh">Choose Me</option>";
// loop while $i is less than count(the amout of elements) of $arr
for($i=0; $i < count($arr); $i++)
echo <option value=". $arr[$i] .">" . $arr[$i] . "</option>";
echo "</select>";
Enjoy.
Instead of using <div class="input">
Do <input type="text" class="input" ....
you may find it works a little better.
not a solution, just a suggestion