Jump to content

justAnoob

Members
  • Posts

    561
  • Joined

  • Last visited

    Never

Everything posted by justAnoob

  1. <?php echo '".substr($row['description'],0,50),"<span class="style666"><a href="http://xxxxxxxx.com/viewitem.php"> ...View</a></span>'; ?> Can't figure out the problem. Keep getting error saying there should be a "," or ";"
  2. then i would just add the href at the end of that correct???,,, for the Read More link.
  3. sorry, ,,, here is the code i have so far. <?php $uid = $_GET['user_id']; $sql = mysql_query("SELECT imgpath, item_name, description, in_return, user_id FROM $table5 ORDER BY id DESC LIMIT 0, 4"); echo "<table border='0' CELLPADDING=5 STYLE='font-size:16px'>"; echo "<table border=1> <tr> <td><H3>Image </h3></td> <td><H3>Item&nbspName</H3></td> <td><H3>Description</H3></td><td><H3>Seeking</H3></td></tr>"; while ($row = mysql_fetch_array($sql)) { echo "<tr><td align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</td><td align='center'>"; echo $row['item_name']; echo "</td><td align='center'>"; echo $row['description']; echo "</td><td align='center'>"; echo $row['in_return']; echo "</td></tr>"; } echo "</table>"; ?>
  4. i have info stored in a mysql table that is displayed into a table on my site. one of the rows in the table is a description that could be a whole lot of text. The code below displays the data from the mysql table but what I'm looking to do is only display about 50 or so characters, and then have a text link after the text saying "Read More". Where should I start going about this???
  5. sorry to post this here,, but no one is ever on the other boards... I'm looking to put some validation on my listmenu on my page.. the validation for my textfields work great ex. <input name="item_name" type="text" id="item_name" size="50" /><span id="item_name_error" class="error"></span> if (!form1.item_name.value) { document.getElementById('item_name_error').innerHTML = 'Please enter a name.'; valid = false; } else { document.getElementById('item_name_error').innerHTML = ''; } thats works perfectly now how would i go about adding the span id into a listmenu?? <select name="listmenu" size="1" id="listmenu"> <option selected="selected">Please select category</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> basically i would like it to say something like if (form1.listmenu.value = "Please select category") { document.getElementById(listmenu_error').innerHTML = 'You did not choose a category.'; valid = false; } I have tried a couple variations,, but I'm still new to all this.. Anyone have any input?
  6. <textarea name="description" id="description" cols="75" rows="7"></textarea><span id="description_error"> i have a text area box and then I would like the description error to appear to the right of the text area box. But I am getting an error with the line above... is the span id in the right location???
  7. Below is the starting of a little search engine that will search 2 fields of a mysql table. Right now it will search 1 field just fine, but on the line below is where I am having trouble getting it to search 2 fields. Any suggestions? <?php include "connection.php"; $search=$_POST["search"]; $query = "SELECT imgpath, x1, x2, x3, user_id FROM member_trades WHERE"; $result = mysql_query("SELECT * FROM $tbl_name1 WHERE x1 LIKE '%$search%'"); // I tried the lines below for getting it to search 2 fields. $uid = $_GET['user_id']; echo "<table border='1' bgcolor='#FFFFFF'><tr><td bgcolor='#B8D2EO'><H3>x1</h3></td><td bgcolor='#B8D2EO'><H3>x2</H3></td><td bgcolor='#B8D2EO'><H3>x3</H3></td><td bgcolor='#B8D2EO'><H3>x4</H3></td><td bgcolor='#B8D2EO'><H3>user_id</H3></td></tr>"; while($row = mysql_fetch_array($result)) { echo "<tr><td align='center'>"; echo '<img src="' . $row['x1'] . '" width="125" alt="" />'; echo "</td><td align='center'>"; echo $row['x2']; echo "</td><td align='center'>"; echo $row['x3']; echo "</td><td align='center'>"; echo $row['x4']; echo "</td><td align='center'>"; echo '<a href="composemessage.php?uid='.$row['user_id'].'"><img src="images/K_little.png" style="border: 0px;" /></a>'; echo "</td></tr>"; } echo "</table>"; //$result = mysql_query("SELECT * FROM $tbl_name1 WHERE x1, x2 LIKE '%$search%'"); //$result = mysql_query("SELECT * FROM $tbl_name1 WHERE x1 AND x2 LIKE '%$search%'"); ?> Also, everyone always talks about security issues with search scripts. What risks are there from someone typing in a keyword from a couple fields in a mysql table and then having the results displayed???? Also,, the script above only displays 1 result,,, even if there are multiple keyword matches.
  8. Thanks for all the help with everything. I do appreciate the time that people put out just to help someone else out.
  9. suprisingly the change that I just made worked...
  10. in my query string shouldn't i be selecting the user_id also... i just noticed that it wasn't there... would that make a difference???? <?php "SELECT imgpath, item_name, description, in_return FROM member_trades WHERE category = 'Video Games' $limit"; ?> change it to <?php "SELECT imgpath, item_name, description, in_return, user_id FROM member_trades WHERE category = 'Video Games' $limit"; ?>
  11. no it does not. read my last post above,,,
  12. i do not think that the GET command is working,, <?php $query = "SELECT imgpath, item_name, description, in_return FROM member_trades WHERE category = 'Video Games' $limit"; $uid = $_GET['user_id']; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); echo "<table border='1' bgcolor='#FFFFFF'><tr><td bgcolor='#B8D2EO'><H3>Image</h3></td><td bgcolor='#B8D2EO'><H3>Item&nbspName</H3></td><td bgcolor='#B8D2EO'><H3>Description</H3></td><td bgcolor='#B8D2EO'><H3>Seeking</H3></td><td bgcolor='#B8D2EO'><H3> Contact&nbspUser</H3></td></tr>"; while ($row = mysql_fetch_array($result)) { echo "<tr><td align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</td><td align='center'>"; echo $row['item_name']; echo "</td><td align='center'>"; echo $row['description']; echo "</td><td align='center'>"; echo $row['in_return']; echo "</td><td align='center'>"; echo '<a href="composemessage.php?uid='.$row['user_id'].'"><img src="images/K_little.png" style="border:0px;" /></a>'; echo "</td></tr>"; } ?> when i click on the picture and it goes to composemessage.php,,,,,, should the url have the username at the end of it. this is what it looks like now composemessage.php?uid= shouldn't the users name be after the =
  13. ok,,, sorry,, i needed to change it to "id" not "user_id" in the line below.. But still having problem... All it shows is a empty text box. $query = "SELECT username FROM members WHERE id = '".$uid."'";
  14. and i did make the change as you said.... there are two tables that I'm working with..... members(which has the id and username) and member_trades(which has user_id, which is the same as the id back in the members table)
  15. unknow colum "user_id" in "where clause" is the error i get when the exit; is commented out
  16. starting to get a little confused on why this is so difficult.... see anything wrong.... <?php $limit = 'LIMIT ' .($pageno - 1) * $rows_per_page .',' .$rows_per_page; $query = "SELECT imgpath, item_name, description, in_return FROM member_trades WHERE category = 'Video Games' $limit"; $uid = $_GET['user_id']; $result = mysql_query($query) or trigger_error("SQL", E_USER_ERROR); echo "<table border='1' bgcolor='#FFFFFF'><tr><td bgcolor='#B8D2EO'><H3>Image</h3></td><td bgcolor='#B8D2EO'><H3>Item&nbspName</H3></td><td bgcolor='#B8D2EO'><H3>Description</H3></td><td bgcolor='#B8D2EO'><H3>Seeking</H3></td><td bgcolor='#B8D2EO'><H3> Contact&nbspUser</H3></td></tr>"; while ($row = mysql_fetch_array($result)) { echo "<tr><td align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</td><td align='center'>"; echo $row['item_name']; echo "</td><td align='center'>"; echo $row['description']; echo "</td><td align='center'>"; echo $row['in_return']; echo "</td><td align='center'>"; echo '<a href="composemessage.php?uid='.$row['user_id'].'"><img src="images/K_little.png" style="border: 0px;" /></a>'; echo "</td></tr>"; } ?> <?php include "connection.php"; mysql_connect("$host", "$username", "$password") or die("Could not connect."); mysql_select_db("$db_name") or die("Could not find database"); $uid = $_GET['uid']; // Added to get the id from the URL $query = "SELECT username FROM members WHERE user_id = '".$uid."'"; echo $query; // see what the query looks like exit; //stop script $result = mysql_query($query) or die(mysql_error()); // Added or die for debugging $user = mysql_fetch_array($result); echo '<form>'; echo '<input type="text" name="to" value="'.$uid['username'].'" />'; echo '</form>'; ?>
  17. unknow column 'user_id' in 'where clause' that is the error that I get instead of the username.. I'm still a little new with all this, but I think i figured it out... if anyone else wants to chime in,, feel free.. thanks.
  18. this gives an error in the line below <?php include "connection.php"; mysql_connect("$host", "$username", "$password") or die("Could not connect."); mysql_select_db("$db_name") or die("Could not find database"); $query = "SELECT username FROM members WHERE user_id = '$uid'"; $result = mysql_query($query); $user = mysql_fetch_array($result); //error here echo '<form>'; echo '<input type="text" name="to" value="'.$user['username'].'" />'; echo '</form>'; ?> so i did this and the text box appears but it is empty,, no username <?php include "connection.php"; mysql_connect("$host", "$username", "$password") or die("Could not connect."); mysql_select_db("$db_name") or die("Could not find database"); $query = "SELECT username FROM members WHERE user_id = '$uid'"; $result = mysql_query($query); //$user = mysql_fetch_array($result); //commented this line out just for fun echo '<form>'; echo '<input type="text" name="to" value="'.$user['username'].'" />'; echo '</form>'; ?> any ideas why the username isn't showing up?
  19. I will give it a try.... Thanks everyone.
  20. when the table is display it looks like this,,, more than 1 user info in a table user1pic description address k_little.png user2pic description address k_little.png user3pic description address k_little.png by clicking the k_little.png i want the username to appear in the to box of the compose message page. the table that holds the info above has a user_id field that holds a number that matches with another table that has the id of that user, which has the username. understand now? sorry for the confusion. each k_little.png will retrieve the username of the user that uploaded the userpic.
  21. ok, i have a table that displays on a page. the table consists of mysql entries from a user. here is the code for the table that is displayed <?php echo "<tr><td align='center'>"; echo '<img src="' . $row['imgpath'] . '" width="125" alt="" />'; echo "</td><td align='center'>"; echo $row['pc_name']; echo "</td><td align='center'>"; echo $row['description']; echo "</td><td align='center'>"; echo $row['in_return']; echo "</td><td align='center'>"; echo "<a href=composemessage.php><img src=\"images/K_little.png\" border='0'></a>"; echo "</td></tr>"; ?> by clicking on the k_little.png it takes you to a screen where you can send a private message to another user. What I'm trying to do is when you click on that k_little picture, i would like it to get the username of the person that you are sending the message to and save it as a $_SESSION variable, so then when your taken to the compose message page of the messaging system, it will already have the username filled in that your sending to message to. Now the mysql table that has the info that is displayed in table format above also has a field in it called user_id, which of course is the same id that I have in another table called members. So how would I go about getting that username????.... I know it will be some sort of query,, but I'm not sure how to write it out? Understand???Basically all the rows that are echoed in the table are assoiciated with different users. Just want to get the username from that row.
  22. Here is all the code,,, form and script... Please remember that the $findit variable works just fine with getting inserted into the mysql row user_id.... that is not the problem... just getting the userid again for the mysql row "from" <form id="form5" name="form5" method="post" action="sendnew.php"> <table width="945" height="215" border="0" cellpadding="0" cellspacing="3"> <tr> <td width="88"><div align="right">Send to:</div></td> <td width="481"><input name="sendto" type="text" id="sendto" size="35" /></td> </tr> <tr> <td><div align="right">Subject:</div></td> <td><input name="subject" type="text" id="subject" size="35" /></td> </tr> <tr> <td height="115"><div align="right">Message:</div></td> <td><textarea name="message" id="message" cols="65" rows="7"></textarea></td> </tr> <tr> <td height="19"><div align="right">From:</div></td> <td><?php echo $username; ?></td> </tr> <tr> <td height="19"> </td> <td> <div align="left"> <input type="submit" name="submit" id="submit" value="Send Message" /> </div></td> </tr> </table> </form> and the script <?php session_start(); include "connection.php"; mysql_connect("$host", "$username", "$password") or die("Could not connect."); mysql_select_db("$db_name") or die("Could not find database"); $sendto = mysql_real_escape_string($_POST['sendto']); $subject = mysql_real_escape_string($_POST['subject']); $message = mysql_real_escape_string($_POST['message']); $findit = $_SESSION['id']; $result=mysql_query("SELECT id FROM members WHERE username = '$findit'"); $row=mysql_fetch_assoc($result); $user_id = $row['id']; $sql = "INSERT INTO member_messages(user_id, sendto, subject, message, from)VALUES('$findit', '$sendto','$subject','$message', '".$_SESSION['id']."')"; mysql_query($sql) or die('There was an error.'); mysql_close(); ?>
  23. user_id in the database gets inserted just fine...... it's the from($from) that is getting the problem.. if i take out the $from variable of the script,, everthing works fine.. the "from" row in the database is varchar with more than enough characters. I don't understand what is going on.
  24. i did the echo of $_SESSION['id'] and it came back as whatever user I am signed in as,, which is good. no problems there. When i echo $from, it comes back as the username also,,, great,,, but when I echo both $findit and $from,,,, nothing appears,,, just gives me my sql error. What is going on????
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.