
ted_chou12
Members-
Posts
1,488 -
Joined
-
Last visited
Everything posted by ted_chou12
-
[SOLVED] Displaying SQL Database On PHP Page?
ted_chou12 replied to snuggles79's topic in PHP Coding Help
id and name refers to the column, for each table u would have columns and rows, rows are just ur entries, and columns r different variables u can store for each entry: idname ted_chou12Ted snuggles79snuggles Ted -
<h2 class='boxtitle'>Meta Description</h2> <textarea class=editblocktext name='metadesc' > <? echo htmlentities($rows['metadesc']); ?> </textarea> <br><br> Ted
-
I am not sure exactly what u r trying to achieve here ??? The php I am familiar is to define a variable as $var = "string"; Ted
-
[SOLVED] Displaying SQL Database On PHP Page?
ted_chou12 replied to snuggles79's topic in PHP Coding Help
http://us.php.net/manual/en/function.mysql-fetch-array.php <?php mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error());// connect to db mysql_select_db("mydb"); $result = mysql_query("SELECT id, name FROM mytable"); //ur query here while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { printf("ID: %s Name: %s", $row["id"], $row["name"]);//echo out here } mysql_free_result($result); ?> Ted -
The best way is start coding, personal comments>> reading tones of manuals tutorials isnt the same as trying ur self, try to code for simple script like a guestbook or something. Ted
-
im not familiar with the language u r using but I guess u should try this: $constant = "Hello world."; echo $constant; //gives u Hello world.
-
Put this in verify.php: <?php if (isset($_POST['submit'])) { $user = $_POST['username']; $email = $_POST['email'];} change register.php to this: <FORM NAME="frmSuccess" METHOD="post" ACTION="verify.php"> <INPUT TYPE="hidden" NAME="email" VALUE="<?php echo $email?>"> <INPUT TYPE="hidden" NAME="username" VALUE="<?php echo $username?>"> <input type="submit" name="submit" /> </FORM>
-
in php variables are usually defined like: $home = "home";//u have to surround texts by quotation marks echo $home; //gives u home. echo "if"; //gives u if echo "and"; //gives u and but the chinese character has nothing to do with this, is the charset problem Ted
-
[SOLVED] PHP to download file througe header
ted_chou12 replied to chathura86's topic in PHP Coding Help
this is the page u want html to store in: <?php echo "test";?> <script type="text/javascript"> <!-- window.location = "test.php" //--> </script> download page separate here: <?php header('Content-type: application/txt'); header('Content-Disposition: attachment; filename="3.txt"'); readfile('3.txt'); ?> Ted -
[SOLVED] PHP to download file througe header
ted_chou12 replied to chathura86's topic in PHP Coding Help
After some investigation, i think this is done with javascript: http://tedchou12.110mb.com/uploads/phpforcedownload.php try if this is what u want Ted -
[SOLVED] PHP to download file througe header
ted_chou12 replied to chathura86's topic in PHP Coding Help
<?php // We'll be outputting a PDF header('Content-type: application/txt'); // It will be called downloaded.pdf header('Content-Disposition: attachment; filename="somefile.txt"'); // The PDF source is in original.pdf readfile('somefile.txt'); ?> dont forget to replace the somefile with ur own txt file name, Ted -
try adding this to the first page: <?php session_start(); if (isset($_POST['KT_Insert1'])) { $add = $_POST['Address']; $_SESSION['Address'] = $add;} ?> //this to the second page: <?php session_start(); echo $_SESSION['Address']; ?> Ted
-
I'm confused, how do your two scripts relate? are they on the same page or different page? are u trying to pass variable to another page??? Ted
-
try this: <?php if (isset($_POST['submit'])) { $number = $_POST['submit']; $array = (0 => 0, 10000 => 4, 20000 => 8,//finish the table with your data) foreach ($array as $key => $val) { if ($number == $key) {echo "matched figure!";}} ?> <input name="name" type="text" size="30" /> <input name="submit" type="submit" />
-
I think is the problem saving the file, ??? but I am not sure about these functions, Ted.
-
if u really want to put it in public_html, try adding a htaccess file that includes the following lines: Order Deny,Allow Deny from all but u have to add this to a folder and have that file u wish not to be accessed directly in the same directory. Ted.
-
in that case, since u have specific variable, try: $text = str_replace($search, $replace, $line);
-
I believe you can, try preg_replace(); u can use regex syntax to capture some kind of variation between <form>*.?</form> but im not an expert in that, u have to ask someone how that regex works. Ted
-
Unable to modify posts with google chrome.
ted_chou12 replied to blueman378's topic in PHPFreaks.com Website Feedback
yeap i have the same problem as well -
I dont quite understand the code, but there are multiple strings in an array, u can call up the string u want by specifying the position of the string through sequence by number eg. $array[0] or a unique id of an associative array $array['key'], in ur case i think you are trying to do this: if ($array['Jeff,employee'] == $string) {//do something here} Let me know if i misunderstood u, Ted
-
imap_header doesn't show unseen messages,
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
still no answers ??? -
<?php if (isset($_POST['search'])){ $query = $_POST['search_query']; header("location: search.php?q=$query");} ?> <form method="post" action="search.php?q="> <p><input type="text" name="search_query" class="textbox" /> <input type="submit" name="search" class="button" value="Search" /></p> </form>
-
<?php while (query...) { $array[] = array($row['id'], $row['name']); $namearray [] = $row['name'];} array_unique($namearray); foreach ($array as $a) { foreach ($namearray as $b) { echo "<tr> <td>name: $b</td>"; if ($b = $a[0]) { echo "<td> id: {$a[1]}</td>";} echo "</tr>";}}} ?> sounds pretty complicated
-
null means the variable is empty, u should probably post some more codes up. Ted
-
Hi there, from the code you've shown here, everything seems to be okay, maybe you can post other codes of your script. Ted.