-
Posts
30 -
Joined
-
Last visited
Never
Everything posted by Eddyon
-
Yep was just about to say with a little modifying it worked: $title1= preg_replace ("/[^a-z0-9+]/","",$title); Cheers for the help Orio and Shogun
-
Cheers Orio, will give it a go.
-
I know this may sound simple but I really do not know how to do it. I have a variable called $title that currently contains symbols such as quotes and question marks, however I would like to create a second variable eg. $title1 that would contain the string with just a-z and 0-9 in it. Thanks in advance for any help, Craig.
-
Yes, just store the URL or path to the image in the database, then pull it in ur php code using something like an echo.
-
have you tried putting </font> after the result?
-
Ah taith is right, i overlooked the ! which is a "not".
-
Before the query, and do an else { query goes here }
-
Try something like this: [code]$query = mysql_query("SELECT * FROM topics WHERE author = $userid"); while($row=mysql_fetch_array($query)){ $thread = $row['thread']; echo "$thread <br>"; }[/code] This is just a general example with no real details of your project or databse structure so just build on it for what you need.
-
And if you do something like: [code]while($row=mysql_fetch_array($query)){ $favourite = $row['favourite']; echo "$favourite <br>"; }[/code] It should list all of the records for that user. Just use that as an example and build from it to suit your needs.
-
Yep, just insert the username and the favourite as a new record.
-
well you could just use something like preg_replace() to replace commars with </tr><tr> to create a new row in a table. also when adding a new one just create a new variable and add ",$newfavourite" onto the old variable. But a better way I would think to do it was to add a table with the columns username and article and just get it to list all results matching that username. That way you can just put a new entry in the table every time they add a new one?
-
Make a link to the download page (which people have to be logged in to view) and put it on that page to forward to the file hidden in a hidden directory so that people cant find it. As it is in the php code the location does not show up on the source, and as far as I am aware, it just says downloading from www.site.com when you download it, and does not say the actual path to the file so people shouldn't be able to easilly find it.
-
Same for me, could you supply a screenshot pointing out your problem or something?
-
image not showing with <? include("../header.php") ?>
Eddyon replied to bickyz's topic in PHP Coding Help
Its just a HTML problem, im guessing on header.php the image is linked to image/bg3.jpg... instead try /mysite/image/bg3.jpg or http://71.18.194.21/mysite/image/bg3.jpg should work then. -
You may find this helpful for hiding the address: http://www.phpfreaks.com/forums/index.php/topic,95433.0.html
-
Hello.. i am need of some help with my news script, but i don't know what the thing is called!! Basically all i wanna do is change; www.mynewssite.com/fullnews.php?date_id=7&id=7 to; www.mynewssite.com/fullnews/7/7.php If you could help me, or know of any tutorials that could help me i would be grateful :)
-
Its $_POST['email'] :)
-
In reply to the first part: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=37442\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=37442[/a]
-
[a href=\"http://www.phpfreaks.com/phpref/120.php\" target=\"_blank\"]Browser[/a] - Tells what the user's browser is capable of, thats about it.
-
how bout putting the user id in rb_order so you know who is ordering the stuff? could be helpful.
-
Complete the process only if theres enough of sumthing
Eddyon replied to cryp7's topic in PHP Coding Help
Ah sorry try this: [code]<?php require ("db_connect.php"); if ($logged_in == 1) { $username = $_SESSION['username']; $query = "SELECT * FROM users WHERE username='$username'"; $results = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($results) == 0) { die("Not logged in, or your session username doesn't exist"); } while ($row = mysql_fetch_array($results)) { $points = $row['points']; } echo "<font face=\"Arial\"><center>Thank You For Purchasing From The Store<p> The Item Has Been Added And The Cost Deducted<p> Please Dont Forget To Come Again<p><a href=\"inventory.php\">Inventory</a></center></font>"; } else { echo "<font face=\"Arial\"><center>Not Logged In <a href=\"login.php\">Login</a></center></font>"; } mysql_connect("localhost", "xxxy", "xxx") or die(mysql_error()); mysql_select_db("xxx") or die(mysql_error()); $user = $_SESSION['username']; $buyid = $_GET['name']; $item = mysql_query("SELECT item_id, name, description, buy_price, sell_price, img_path FROM items WHERE item_id='$buyid'"); $row2=mysql_fetch_array($item); $buyprice = $row2['buy_price']; if ($points < $buyprice) { echo 'You do not have enough points'; } else { $subval = $points-$buyprice; mysql_query("INSERT INTO inventory (id, username, item_id) VALUES('', '$user', '$buyid')"); mysql_query("UPDATE users SET points = '$subval' WHERE username = '$user'"); mysql_free_result($item); mysql_close(); } ?>[/code] -
Complete the process only if theres enough of sumthing
Eddyon replied to cryp7's topic in PHP Coding Help
Try replacing the bit at the end with this: [code]if ($points < $buyprice) { echo 'You do not have enough points } else { $subval = $points-$buyprice; mysql_query("INSERT INTO inventory (id, username, item_id) VALUES('', '$user', '$buyid')"); mysql_query("UPDATE users SET points = '$subval' WHERE username = '$user'"); mysql_free_result($item); mysql_close(); }[/code] So that would be, [code]<?php require ("db_connect.php"); if ($logged_in == 1) { $username = $_SESSION['username']; $query = "SELECT * FROM users WHERE username='$username'"; $results = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($results) == 0) { die("Not logged in, or your session username doesn't exist"); } while ($row = mysql_fetch_array($results)) { $points = $row['points']; } echo "<font face=\"Arial\"><center>Thank You For Purchasing From The Store<p> The Item Has Been Added And The Cost Deducted<p> Please Dont Forget To Come Again<p><a href=\"inventory.php\">Inventory</a></center></font>"; } else { echo "<font face=\"Arial\"><center>Not Logged In <a href=\"login.php\">Login</a></center></font>"; } mysql_connect("localhost", "xxxy", "xxx") or die(mysql_error()); mysql_select_db("xxx") or die(mysql_error()); $user = $_SESSION['username']; $buyid = $_GET['name']; $item = mysql_query("SELECT item_id, name, description, buy_price, sell_price, img_path FROM items WHERE item_id='$buyid'"); $row2=mysql_fetch_array($item); $buyprice = $row2['buy_price']; if ($points < $buyprice) { echo 'You do not have enough points } else { $subval = $points-$buyprice; mysql_query("INSERT INTO inventory (id, username, item_id) VALUES('', '$user', '$buyid')"); mysql_query("UPDATE users SET points = '$subval' WHERE username = '$user'"); mysql_free_result($item); mysql_close(); } ?>[/code] -
[a href=\"http://www.phpfreaks.com/tutorials/43/0.php\" target=\"_blank\"]Pagination: Easy as PREV 1 2 3 NEXT[/a] Nice tutorial there from TheReverend. And here is another, this time by phpfreak. [a href=\"http://www.phpfreaks.com/tutorials/73/1.php\" target=\"_blank\"]Page Numbering With PHP And MySQL Results[/a]
-
set your time limit as 45 days: $limit_time = time() - 3888000; and then in your query include this where clause: WHERE UNIX_TIMESTAMP(dateposted) >= $limit_time Try giving that a go, let us know how you get on.
-
Or just do $total*0.8, that will give you the same effect but is just shorter.