Newb advice
Moderator: General Moderators
Re: Newb advice
Where ?
Re: Newb advice
Instead of
Code: Select all
if($_GET['something'] || $_POST['something']);
//use
if(isset($_GET['something']) || isset($_POST['something']));Re: Newb advice
Doh ! Of course - works a treat.
Thanks
Thanks
Re: Newb advice
That's ironed out a few bugs across the system...
Any ideas on this error that has popped up recently on my profile and edit profile scripts ?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Any ideas on this error that has popped up recently on my profile and edit profile scripts ?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
-
pankajnagarkoti70
- Forum Newbie
- Posts: 4
- Joined: Fri Sep 25, 2009 5:31 pm
Re: Newb advice
Any advice on how to name and number the uploaded files rather than give them a date stamp ?
Re: Newb advice
read the first couple of pages of posts on this thread because I had the same issue and it was solved here.pankajnagarkoti70 wrote:Any advice on how to name and number the uploaded files rather than give them a date stamp ?
Best wishes
Monty
Re: Newb advice
Yeah this seems to be a bit of a monster thread lol.
Post your code.MiniMonty wrote:Any ideas on this error that has popped up recently on my profile and edit profile scripts ?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Re: Newb advice
Herewith...
it's the second version of line 37 (if that makes any sense).
it's actually line 137 but the line numbers on this forum seem to start again at 100.
it's the second version of line 37 (if that makes any sense).
it's actually line 137 but the line numbers on this forum seem to start again at 100.
Code: Select all
<?php
session_start();
// Connect to database
include_once "scripts/connect_to_mysql.php";
// $host = "localhost";
// $user="blahblahblah";
// $password="blahblahblah";
// $database="blahblahblah";
// $connection = mysql_connect($host, $user,$password)
// or die ("Couldn't connect to server.");
// $db = mysql_select_db($database, $connection)
// or die ("Couldn't select the database.");
// Now let's initialize vars to be printed to page in the HTML section so our script does not return errors
// they must be initialized in some server environments
$id = "";
$firstname = "";
$lastname = "";
$bio_body = "";
$website = "";
$youtube = "";
$user_pic = "";
$blabberDisplayList = "";
// If coming from category page
//if ($_GET['id']) {
//$id = $_GET['id'];
if(isset($_GET['id']) || isset($_POST['id']));
else if (isset($_SESSION['id'])) {
$id = $_SESSION['id'];
} else {
include_once "index.php";
exit();
}
$id = mysql_real_escape_string($id);
$id = eregi_replace("`", "", $id);
$sql = mysql_query("SELECT * FROM myMembers WHERE id='$id'");
while($row = mysql_fetch_array($sql)){
$firstname = $row["firstname"];
$lastname = $row["lastname"];
$email = $row["email"];
//$email = "<a href=\"mailto:$email\"><u><font color=\"#006600\">Mail</font></u></a>";
$sign_up_date = $row["sign_up_date"];
$sign_up_date = strftime("%b %d, %Y", strtotime($sign_up_date));
$last_log_date = $row["last_log_date"];
$last_log_date = strftime("%b %d, %Y", strtotime($last_log_date));
$bio_body = $row["bio_body"];
$website = $row["website"];
$youtube = $row["youtube"];
/////// Mechanism to Display Pic. See if they have uploaded a pic or not //////////////////////////
$check_pic = "members/$id/image01.jpg";
$default_pic = "members/0/image01.jpg";
if (file_exists($check_pic)) {
$user_pic = "<img src=\"$check_pic\" width=\"200px\" />"; // forces picture to be 100px wide and no more
} else {
$user_pic = "<img src=\"$default_pic\" width=\"200px\" />"; // forces default picture to be 100px wide and no more
}
/////// Mechanism to Display Youtube Channel or not //////////////////////////
if ($youtube == "") {
$youtubeChannel = "<br />This user has no YouTube channel yet.";
} else {
$youtubeChannel = ' <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/youtube.xml&up_channel=' . $youtube . '&synd=open&w=290&h=370&title=&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script> '; // forces default picture to be 100px wide and no more
}
} // close while loop
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$style_sheet = "default";
?>
<?php
// Place Blab post into database
$blab_outout_msg = "";
if ($_POST['blab_field'] != ""){
// Delete any blabs over 20 for this member
$sqlDeleteBlabs = mysql_query("SELECT * FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 50");
$bi = 1;
while ($row = mysql_fetch_array($sqlDeleteBlabs)) {
$blad_id = $row["id"];
if ($bi > 20) {
$deleteBlabs = mysql_query("DELETE FROM blabbing WHERE id='$blad_id'");
}
$bi++;
}
// End Delete any blabs over 20 for this member
$blab_field = $_POST['blab_field'];
$blab_field = stripslashes($blab_field);
$blab_field = strip_tags($blab_field);
$blab_field = mysql_real_escape_string($blab_field);
$blab_field = eregi_replace("'", "'", $blab_field);
$sql = mysql_query("INSERT INTO blabbing (mem_id, the_blab, blab_date)
VALUES('$id','$blab_field', now())")
or die (mysql_error());
$blab_outout_msg = "Your Blab has been posted!";
}
?>
<?php
$the_blab_form = "";
if (isset($_SESSION['id'])) {
if ($_SESSION['id'] == $id){
$the_blab_form = '
' . $blab_outout_msg . '
<form action="profile.php" method="post" enctype="multipart/form-data" name="blab_from">
<textarea name="blab_field" rows="3" style="width:97%;"></textarea>
Blab away (220 char max) <input name="submit" type="submit" value="submit" />
</form>';
}
}
?>
<?php
$sql_blabs = mysql_query("SELECT id, mem_id, the_blab, blab_date FROM blabbing WHERE mem_id='$id' ORDER BY blab_date DESC LIMIT 20");
while($row = mysql_fetch_array($sql_blabs)){
$blabid = $row["id"];
$uid = $row["mem_id"];
$the_blab = $row["the_blab"];
$blab_date = $row["blab_date"];
$blab_date = strftime("%b %d, %Y, %Y %I:%M:%S %p", strtotime($blab_date));
$blabberDisplayList .= '
<table width="100%" align="center" cellpadding="4" bgcolor="#A6D2FF">
<tr>
<td width="93%" bgcolor="#D9ECFF"><span style="font-size:10px; font-weight:bold; color:#A6A6A6;">' . $blab_date . '</span><br />
' . $the_blab . '</td>
</tr>
</table>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Description" content="Profile for <?php print "$firstname $lastname"; ?>" />
<meta name="Keywords" content="<?php print "$firstname, $lastname"; ?>" />
<meta name="rating" content="General" />
<meta name="ROBOTS" content="All" />
<title>Site Profile for <?php print "$firstname $lastname"; ?></title>
<link href="style_profiles/<?php print "$style_sheet"; ?>.css" rel="stylesheet" type="text/css" />
<link rel="icon" href="http://www.yourdomain.com/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.yourdomain.com/favicon.ico" type="image/x-icon" />
</head>
<body>
<?php include_once "header_template.php"; ?>
<table width="950" align="center">
<tr>
<td width="758"><br />
<table width="90%" border="0" align="center" cellpadding="6">
<tr>
<td width="48%" valign="top">
<?php print "$firstname $lastname"; ?>
<br />
<?php print "$user_pic"; ?>
<br />
Member Since: <?php print "$sign_up_date"; ?>
<br />
<?php print "$youtubeChannel"; ?>
</td>
<td width="52%" valign="top">
<br />
<strong><u><?php print "$firstname $lastname"; ?>'s Blabs:</u></strong>
<br />
<?php print "$the_blab_form"; ?>
<div style="width:100%; height:180px; overflow:auto; overflow-x:hidden;">
<?php print "$blabberDisplayList"; ?>
</div>
<br />
<br />
<strong><u><?php print "$firstname $lastname"; ?>'s Location Details:</u></strong>
<br />
<br />
<strong><u>About <?php print "$firstname $lastname"; ?></u></strong>
<br />
<?php print "$bio_body"; ?>
<br />
</td>
</tr>
<tr>
<td colspan="2" valign="top"> </td>
</tr>
</table>
<p><br />
<br />
</p>
<p> </p>
<p><br />
<br />
<br />
<br />
<br />
</p></td>
<td width="180" valign="top"><?php include_once "right_AD_template.php"; ?></td>
</tr>
</table>
<?php include_once "footer_template.php"; ?>
</body>
</html>
Re: Newb advice
Monty, I just wanted to say that I really admire your site design. Is that from a template or is that totally from scratch? I did notice one tiny typo in your "Learn It" box on the first page ("shedule"). Also with regard to those boxes, I noticed that the 1st and 3rd boxes' text changes to darker color when the mouse hovers, but not the 2nd and 4th box, which I found a bit disoncerting. At first I thought it might be a matter of a "visited" link, but it doesn't appear to be that. Just thought I'd mention those small things.
Re: Newb advice
Ha I forgot I even contributed to this thread.califdon wrote:Monty, I just wanted to say that I really admire your site design. Is that from a template or is that totally from scratch? I did notice one tiny typo in your "Learn It" box on the first page ("shedule"). Also with regard to those boxes, I noticed that the 1st and 3rd boxes' text changes to darker color when the mouse hovers, but not the 2nd and 4th box, which I found a bit disoncerting. At first I thought it might be a matter of a "visited" link, but it doesn't appear to be that. Just thought I'd mention those small things.
What's the URL? I went through the first few pages, but didn't find it. I'm curious, calif
Re: Newb advice
Try putting
on line 136.
Also, put "or die(mysql_error());" after the query.
Code: Select all
var_dump($sql_blabs);Also, put "or die(mysql_error());" after the query.
Re: Newb advice
You gave up too soonMirge wrote:What's the URL? I went through the first few pages, but didn't find it. I'm curious, calif
...but remove the space before "www". Dunno how that got in there.Re: Newb advice
Postby MiniMonty on Fri Sep 25, 2009 2:09 pm
Hi all,
...
As you know by now I'm trying to build a membership system - if you feel like joining up it's free and it's here:
http://%20www.shutterbugclub.com
it's going OK but now I'm stumbling over the member profile page.
Re: Newb advice
Ah ok thanks.califdon wrote:You gave up too soonMirge wrote:What's the URL? I went through the first few pages, but didn't find it. I'm curious, calif(page5, I believe):
...but remove the space before "www". Dunno how that got in there.Re: Newb advice
Postby MiniMonty on Fri Sep 25, 2009 2:09 pm
Hi all,
...
As you know by now I'm trying to build a membership system - if you feel like joining up it's free and it's here:
http://%20www.shutterbugclub.com
it's going OK but now I'm stumbling over the member profile page.
Yeah, that's not half bad. The text is a little big for me... and I'd probably have used a different font. The colors work nicely together though!
Re: Newb advice
Kinda weird though - the layout seems to jump up and down a bit for different pages.
Re: Newb advice
True - It's very much a work in progress.jackpf wrote:Kinda weird though - the layout seems to jump up and down a bit for different pages.
Most of the pages are built in Flash, some in html and the design is about 75% done.
I'm concentrating on the back end at the moment trying to get the membership system working
with view and edit profile, members avatar pics etc., but I appreciate all the comments.
Give it a month or so (in between 'real' work) and it should be ready to rock.
The design is all my own but the functionality is based on a tutorial for a complete site
I found here:
http://www.webintersect.com/parts.php
Best wishes
Monty