By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,983 Members | 1,582 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,983 IT Pros & Developers. It's quick & easy.

Novice needs help :)

P: n/a
Hi

I run a directory, where programs are listed based on the number of
clicks they have recieved. The program with most clicks are placed on
top and so on. Now I would like people to be apple to place a link on
there site so people can vote for their program, "ad a click". eg
someone clicks the link on some page and it counts +1 click on my page.
if some one clicks the link below it will count a click on my page.
http://www.affiliatesjunction.net/di...?ax=out&id=280

Now how can I have this link showed, in a textfield, when someone ads
their program?
I don't reaaly know much about php, so please just let me know what
information is needed for you guys, so you can help me out!
Casper
my site is http://www.affiliatesjunction.net

I'd like this like to show up after someone ads their link (thank you
page) . If you want to try it out just ad a link with "google test" or
something as title.

Nov 16 '06 #1
Share this Question
Share on Google+
23 Replies


P: n/a
You'll want to populate the textfield -- I would suggest a text box --
when the output page loads. I assume that you can pull the required
query string variables from a database. So, without knowing too much
about your setup and assuming that the two required query string
variables are "ax" (with a constant value of "out") and "id" (with the
value of the page/ account whose click count will be incremented, it
would look something like this:

---->CODE <<----
<?php
/* Get the user id */
// If you use a database or have passed the user id to the output
// script, you may want to put it in a friendly variable here. I'm
// going to use $userid
?>

<!-- Now out the html leading up to the textbox -->

<textarea name="outputLink">
http://www.affiliatesjunction.net/directory.php?ax=out&id=<?=$userid?>
</textarea>

<!-- Put the rest of the html here -->
---->END CODE <<----

Or something like that. It will of course vary in how you get the user
id, but the general idea is there.

HTH

casper christensen wrote:
Hi

I run a directory, where programs are listed based on the number of
clicks they have recieved. The program with most clicks are placed on
top and so on. Now I would like people to be apple to place a link on
there site so people can vote for their program, "ad a click". eg
someone clicks the link on some page and it counts +1 click on my page.
if some one clicks the link below it will count a click on my page.
http://www.affiliatesjunction.net/di...?ax=out&id=280

Now how can I have this link showed, in a textfield, when someone ads
their program?
I don't reaaly know much about php, so please just let me know what
information is needed for you guys, so you can help me out!
Casper
my site is http://www.affiliatesjunction.net

I'd like this like to show up after someone ads their link (thank you
page) . If you want to try it out just ad a link with "google test" or
something as title.
Nov 16 '06 #2

P: n/a
Weel u got the point, thats exactly what I'm looking for.

only problem is I don't knonw how,where or what to do with that
"$userid?" thing.

I don't know what this cod should really be, or where to find it.

Will it help If I published the php-pages for you to look at?

casper

clashers5 skrev:
You'll want to populate the textfield -- I would suggest a text box --
when the output page loads. I assume that you can pull the required
query string variables from a database. So, without knowing too much
about your setup and assuming that the two required query string
variables are "ax" (with a constant value of "out") and "id" (with the
value of the page/ account whose click count will be incremented, it
would look something like this:

---->CODE <<----
<?php
/* Get the user id */
// If you use a database or have passed the user id to the output
// script, you may want to put it in a friendly variable here. I'm
// going to use $userid
?>

<!-- Now out the html leading up to the textbox -->

<textarea name="outputLink">
http://www.affiliatesjunction.net/directory.php?ax=out&id=<?=$userid?>
</textarea>

<!-- Put the rest of the html here -->
---->END CODE <<----

Or something like that. It will of course vary in how you get the user
id, but the general idea is there.

HTH

casper christensen wrote:
Hi

I run a directory, where programs are listed based on the number of
clicks they have recieved. The program with most clicks are placed on
top and so on. Now I would like people to be apple to place a link on
there site so people can vote for their program, "ad a click". eg
someone clicks the link on some page and it counts +1 click on my page.
if some one clicks the link below it will count a click on my page.
http://www.affiliatesjunction.net/di...?ax=out&id=280

Now how can I have this link showed, in a textfield, when someone ads
their program?
I don't reaaly know much about php, so please just let me know what
information is needed for you guys, so you can help me out!
Casper
my site is http://www.affiliatesjunction.net

I'd like this like to show up after someone ads their link (thank you
page) . If you want to try it out just ad a link with "google test" or
something as title.
Nov 16 '06 #3

P: n/a
Found another "problem", after submitting the form, it doesn't actually
link to a thank you page. It uses some "echo" code to write some
sentences. So how can I chance this so when submitting the form, it
links to a new page.

casper
PS I know noooob:)

Nov 16 '06 #4

P: n/a
Well, I found out how to the the vote-code...thanks!
Now how do I make the form "linking" to another site. (after submiiting
it should go to like a thank you page)?

casper

Nov 16 '06 #5

P: n/a
casper christensen wrote:
Now how do I make the form "linking" to another site. (after submiiting
it should go to like a thank you page)?
<?php
// deal with submit data
// do not output anything!

// redirect to "thank you" page
header('Location: http://www.example.com/thankyou');
exit(0);
?>

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Nov 16 '06 #6

P: n/a
Hi

thanks for the reply. Unfortunately this doesn't do me any good. I need
a code so when the submit button is clicked it should go to my desired
page. Also It must perform the actions already coded ( adding the
information to the database and so on.)

This must be possible.

Casper

Pedro Graca skrev:
casper christensen wrote:
Now how do I make the form "linking" to another site. (after submiiting
it should go to like a thank you page)?

<?php
// deal with submit data
// do not output anything!

// redirect to "thank you" page
header('Location: http://www.example.com/thankyou');
exit(0);
?>

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Nov 16 '06 #7

P: n/a
casper christensen wrote:
Pedro Graca skrev:
>>casper christensen wrote:
>>>Now how do I make the form "linking" to another site. (after submiiting
it should go to like a thank you page)?

<?php
// deal with submit data
// do not output anything!

// redirect to "thank you" page
header('Location: http://www.example.com/thankyou');
exit(0);
?>

--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.


Hi

thanks for the reply. Unfortunately this doesn't do me any good. I need
a code so when the submit button is clicked it should go to my desired
page. Also It must perform the actions already coded ( adding the
information to the database and so on.)

This must be possible.

Casper
(Top posting fixed)

Casper,

That's exactly what Pedro's code does. Put it after the code to add
your info to the database.

The only think you need to be careful of is that NOTHING is output to
the browser before this call. No messages, no whitespace, nothing.
Then when it gets to this code it will instruct the browser to
automatically request the page "thankyou".

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 16 '06 #8

P: n/a
Well it doesn't work, it redirect before the form appears or not at
all. Point is the script the form is on contains several forms. Here is
the entire page.(I've pointed out the part I want to edit)
<?php
ob_start();
include('config.php');
include('banner_lib.php');

include('header.php');
$ax=$_GET["ax"];
$list_type=$_GET["l"];

////////////////
// List Function
////////////////

if ($ax=="list")
{
if($list_type=="clicks")
{
echo "<p class=\"bodylgbold\">$popular Most Popular Links</p>";
echo "<p class=\"bodysm\"&gt; <a href=\"$PHP_SELF\">Home</a&gt;
Popular Links</p>";
$sql_rqst="SELECT * FROM links WHERE approved='yes' ORDER BY clicks
DESC LIMIT 0,".$popular;
}
else if($list_type=="date_added")
{
echo "<p class=\"bodylgbold\">$new Newest Links</p>";
echo "<p class=\"bodysm\"&gt; <a href=\"$PHP_SELF\">Home</a&gt;
Newest Links</p>";
$sql_rqst="SELECT * FROM links WHERE approved='yes' ORDER BY
date_added,id ASC LIMIT 0,".$new;
}
else
{
$topic_result = MySQLQuery("SELECT * FROM links_cat WHERE
id=$cat_id", $QueryError_Email,$QueryError_Browser);
while($topic_row = mysql_fetch_array($topic_result))
{
$id=$topic_row["id"];
$formcat_id=$topic_row["id"];
$sub_cat=$topic_row["sub_cat"];
$name=$topic_row["name"];
$dsc=$topic_row["dsc"];
}
if($sub_cat != 0)
{
$topic2_result = MySQLQuery("SELECT id,sub_cat,name FROM links_cat
WHERE id=$sub_cat", $QueryError_Email,$QueryError_Browser);
while($topic2_row = mysql_fetch_array($topic2_result))
{
$id2=$topic2_row["id"];
$sub_cat2=$topic2_row["sub_cat"];
$name2=$topic2_row["name"];
}
$trail="<a
href=\"$PHP_SELF?ax=list&amp;sub=$id2&amp;cat_id=$ id2\">$name2</a&gt;
$name";
}
else
{
$trail=$name;
}
echo "<p class=\"bodylgbold\">$name</p>";
echo "<p class=\"bodysm\"&gt; <a href=\"$PHP_SELF\">Home</a&gt;
$trail</p>";
echo "<p class=\"bodymd\">$dsc</p>";
if(!isset($start)){$start = 0;}
$sql_rqst="SELECT * FROM links WHERE cat_id=".$_GET["cat_id"]." AND
approved='yes' ORDER BY ".$list_by." ".$list_order." LIMIT
".$start.",".$category;
$page_result = MySQLQuery("SELECT * FROM links WHERE
cat_id=$cat_id",$QueryError_Email,$QueryError_Brow ser);
$previous_page=$start - $category;
$next_page=$start + $category;
$numrows=mysql_num_rows($page_result);
if(($start 0) || ($numrows ($start + $category))){echo "<p
class=\"bodysm\">";}
if($start 0){echo "[ <a
href=\"$PHP_SELF?ax=list&amp;l=list_by&amp;cat_id= $cat_id&amp;start=$previous_page\">&lt;
&lt; Previous</a]\n";}
if($numrows ($start + $category)){echo "[ <a
href=\"$PHP_SELF?ax=list&amp;l=list_by&amp;cat_id= $cat_id&amp;start=$next_page\">Next
&gt; &gt;</a]\n";}
if(($start 0) || ($numrows ($start + $category))){echo "</p>";}
}
$result =
MySQLQuery($sql_rqst,$QueryError_Email,$QueryError _Browser);
while($row = mysql_fetch_array($result))
{
$id=$row["id"];
$name=$row["name"];
$clicks=$row["clicks"];
$approved=$row["approved"];
$url=$row["url"];
$dsc=$row["dsc"];
$date_added=$row["date_added"];
$year = substr($date_added, 0, 4);
$month = substr($date_added, 5, 2);
$day = substr($date_added, 8, 2);
$date_added=date($display_format,mktime("00","00", "00",$month,$day,$year));
$image=$row["image"];
$rating=$row["rating"];
$rates=$row["rates"];
if($image_enabled=="yes" && $image)
{
$image="<img src=\"$image\" align=\"right\" width=125 height=100>";
}
else
{
$image="";
}
if($rates=="" || $rates=="0")
{
$rate_stat="<i>Not Yet Rated</i>";
}
else
{
$rating=$rating / $rates;
$rating=round($rating,2);
$rate_stat=$rating." out of 10";
}
if($clicks==""){$clicks="0";}
?>
<script type="text/javascript">
<!--
function validate_rate<?php echo $id; ?>()
{
if(document.getElementById('form<?php echo $id;
?>').rating.selectedIndex == 0){alert("Please select your rating for
<?php echo $name ?from 1-10.");return false;}
}
//-->
</script>
<p class="bodymd"><?php echo $image; ?><a class=categorylinks
href="<?php echo $PHP_SELF ?>?ax=out&amp;id=<?php echo $id ?>"
target=_blank><?php echo $name ?></a>
<br /><span class="bodysm">Added: <?php echo $date_added ?| Total
Clicks: <?php echo $clicks ?| Rating: <font color=FF0000><B><?php
echo $rate_stat ?></B></font| <a href="#" onclick="blocking('<?php
echo $id ?>');return false;">Rate This Website</a| <a href="<?php
echo $PHP_SELF ?>?ax=deadlink&amp;id=<?php echo $id ?>">Notify of Dead
Link</a<BR></span>
<br /><?php echo $dsc ?><hr size="1" noshade="noshade" />
<br /><div id="<?php echo $id ?>"><form action="<?php echo $PHP_SELF
?>?ax=addrate&amp;id=<?php echo $id ?>&amp;cat_id=<?php echo
$formcat_id; ?>&amp;l=<?php echo $list_type; ?>" method="post"
id="form<?php echo $id; ?>" onsubmit="return validate_rate<?php echo
$id; ?>();"><span class="bodysm">Rate This Website</span<select
name="rating" class="bodysm"><option>- choose --</option><option
value="1">1</option><option value="2">2</option><option
value="3">3</option><option value="4">4</option><option
value="5">5</option><option value="6">6</option><option
value="7">7</option><option value="8">8</option><option
value="9">9</option><option value="10">10</option></select<input
type="submit" name="submit" value="Rate <?php echo $name ?>"
class="bodysm" /></div></form>
</p>
<script type="text/javascript">
<!--
document.getElementById('<?php echo $id ?>').style.display='none';
//-->
</script>
<?php
}
if($_GET["l"]!="date_added" && $_GET["l"]!="clicks")
{
if(($start 0) || ($numrows ($start + $category))){echo "<p
class=\"bodysm\">";}
if($start 0){echo "[ <a
href=\"$PHP_SELF?ax=list&amp;l=list_by&amp;cat_id= $cat_id&amp;start=$previous_page\">&lt;
&lt; Previous</a]\n";}
if($numrows ($start + $category)){echo "[ <a
href=\"$PHP_SELF?ax=list&amp;l=list_by&amp;cat_id= $cat_id&amp;start=$next_page\">Next
&gt; &gt;</a]\n";}
if(($start 0) || ($numrows ($start + $category))){echo "</p>";}
}
}
else if($ax=="out")
{
$result = MySQLQuery("SELECT id,url,clicks FROM links WHERE
id=".$_GET["id"],$QueryError_Email,$QueryError_Browser);
while($row = mysql_fetch_array($result))
{
$id=$row["id"];
$url=$row["url"];
$clicks=$row["clicks"];
$clicks=$clicks+1;
$up_clicks = MySQLQuery("UPDATE links SET clicks='$clicks' WHERE
id='$id'",$QueryError_Email,$QueryError_Browser);
ob_end_clean();
header("Location: ".$url);
}
}
else if($ax=="deadlink")
{
$result = MySQLQuery("SELECT id,name,url FROM links WHERE
id=".$_GET["id"],$QueryError_Email,$QueryError_Browser);
while($row = mysql_fetch_array($result))
{
$id=$row["id"];
$url=$row["url"];
$name=$row["name"];
$clicks=$clicks+1;
$message="$name\n$url\nis being reported as a dead link in the links
directory at $site_title";
mail("$admin_mail","Dead Link Report from
$site_title","$message","From: $admin_mail");
echo "<p class=\"bodylgbold\">Thank You</p>";
echo "<p class=\"bodysm\"&gt; <a href=\"$PHP_SELF\">Home</a&gt;
Report Dead Link</p>";
echo "<p class=\"bodymd\">You have reported $name linked to $url as
being a deal link in our directory.</p>";
echo "<p class=\"bodymd\">This message has been sent to the web site
administrator, thank you for your help.</p>";
}
}
else if($ax=="addrate")
{
$id=$_GET["id"];
$cat_id=$_GET["cat_id"];
$new_rating=$_POST["rating"];
$result = MySQLQuery("SELECT id,rating,rates FROM links WHERE
id=$id;",$QueryError_Email,$QueryError_Browser);
while($row = mysql_fetch_array($result))
{
$rating=$row["rating"];
$rating=$rating + $new_rating;
$rates=$row["rates"];
$rates=$rates + 1;
$up_clicks = MySQLQuery("UPDATE links SET
rating='$rating',rates='$rates' WHERE
id='$id'",$QueryError_Email,$QueryError_Browser);
echo "<p class=\"bodylgbold\">Thanks for your input</p>\n";
echo "<p class=\"bodysm\"&gt; <a href=\"$PHP_SELF\">Home</a&gt;
Rating</p>";
echo "<p class=\"bodymd\">Your rating has been added, thank
you.</p>\n";
}
if($list_type=="")
{
$sub_result = MySQLQuery("SELECT id,sub_cat FROM links_cat WHERE
id=".$cat_id."",$QueryError_Email,$QueryError_Brow ser);
while($sub_row = mysql_fetch_array($sub_result))
{
$list_type=$_GET["l"];
if($list_type=="")
{
$id=$sub_row["id"];
$subcat=$sub_row["sub_cat"];
if($subcat==0){$subcat=$id;}
echo "<p class=\"bodymd\">To return to the page you were at, <a
href=\"".$_SERVER["PHP_SELF"]."?ax=list&amp;sub=".
$subcat."&amp;cat_id=".$id."\">click here</a>.</p>\n";
}
}
}
else
{
echo "<p class=\"bodymd\">To return to the page you were at, <a
href=\"".$_SERVER["PHP_SELF"]."?ax=list&amp;l=".$_GET["l"]."\">click
here</a>.</p>\n";
}
}

//////////////////
// Search Function
//////////////////

else if ($ax=="search")
{
echo "<p class=\"bodylgbold\">Search Results</p>";
echo "<p class=\"bodysm\"&gt; <a href=\"$PHP_SELF\">Home</a&gt;
Search Results</p>";
if(!isset($start))
{
$start = 0;
$search_for=$_POST["search_for"];
}
else
{
$search_for=$_GET["search_for"];
}
$result = MySQLQuery("SELECT * FROM links WHERE (name LIKE
'%".$search_for."%' OR url LIKE '%".$search_for."%' OR dsc LIKE
'%".$search_for."%') AND approved='yes' ORDER BY name ASC LIMIT
$start,$search",$QueryError_Email,$QueryError_Brow ser);
$page_result = MySQLQuery("SELECT * FROM links WHERE (name LIKE
'%".$search_for."%' OR url LIKE '%".$search_for."%' OR dsc LIKE
'%".$search_for."%') AND approved='yes' ORDER BY id
DESC",$QueryError_Email,$QueryError_Browser);
$previous_page=$start - $search;
$next_page=$start + $search;
$numrows=mysql_num_rows($page_result);
echo "<p class=\"bodymd\">Total of $numrows Records Returned</p>";
if(($start 0) || ($numrows ($start + $search))){echo "<p
class=\"bodysm\">";}
if($start 0){echo "[ <a
href=\"$PHP_SELF?ax=search&amp;search_for=$search_ for&amp;start=$previous_page\">&lt;
&lt; Previous</a]\n";}
if($numrows ($start + $search)){echo "[ <a
href=\"$PHP_SELF?ax=search&amp;search_for=$search_ for&amp;start=$next_page\">Next
&gt; &gt;</a]\n";}
if(($start 0) || ($numrows ($start + $search))){echo "</p>";}
while($row = mysql_fetch_array($result))
{
$id=$row["id"];
$name=$row["name"];
$clicks=$row["clicks"];
$approved=$row["approved"];
$url=$row["url"];
$dsc=$row["dsc"];
if ($approved=="yes")
{
if($clicks==""){$clicks="0";}
echo "<p class=\"bodymd\"><a class=categorylinks
href=\"$PHP_SELF?ax=out&amp;id=$id\">$name</a>
<br /><span class=\"bodysm\">[ <a
href=\"$PHP_SELF?ax=out&amp;id=$id\">$url</a| Total Clicks: $clicks |
<a href=\"$PHP_SELF?ax=deadlink&amp;id=$id\">Notify of Dead Link</a>
]</span>
<br />$dsc</p>";
}
}
if(($start 0) || ($numrows ($start + $search))){echo "<p
class=\"bodysm\">";}
if($start 0){echo "[ <a
href=\"$PHP_SELF?ax=search&amp;search_for=$search_ for&amp;start=$previous_page\">&lt;
&lt; Previous</a]\n";}
if($numrows ($start + $search)){echo "[ <a
href=\"$PHP_SELF?ax=search&amp;search_for=$search_ for&amp;start=$next_page\">Next
&gt; &gt;</a]\n";}
if(($start 0) || ($numrows ($start + $search))){echo "</p>";}
}

----------------------------------------------this is the form I need
to edit------------------------------------------

///////////////////////////
// Add and Insert Functions
///////////////////////////

else if($ax=="add")
{
$date_added=date($date_format);
?>
<p class="bodylgbold">Add a Link</p>
<p class="bodysm"&gt; <a href="<?php echo $PHP_SELF; ?>">Home</a>
&gt; Add a Link</p>
<p class="bodymd">All Fields are required for link submission</p>
<form action="<?php echo $PHP_SELF; ?>?ax=insert" method="post"
id="form" onsubmit="return validate_add();">
<table border="0" width="100%" cellspacing="2" cellpadding="0">
<tr>
<td class="bodymd"><span style="color:#FF0000;">*</span>Category:<br
/>
<select name="cat_id">
<option value="">Select a Category</option>
<?php
$result=MySQLQuery("select * from links_cat where id !=0 order by
name",$QueryError_Email,$QueryError_Browser);
while($row=mysql_fetch_array($result))
{
$cat_id=$row["id"];
$cat_name=$row["name"];
echo "<option value=\"$cat_id\"$cat_name</option>";
}
?>
</select>
</td>
</tr>
<tr><td class="bodymd">Website Name<span
style="color:#FF0000;">*</span>:<br /><input name="name" type="text"
size="60"/></td></tr>
<tr>
<td class="bodymd">Website Description<span
style="color:#FF0000;">* <font color="#000000">(Max
255 characters)</font></span><font color="#000000">:</font><br
/>
<textarea name="dsc" rows="3" cols="40"></textarea></td></tr>
<tr><td class="bodymd">URL<span style="color:#FF0000;">*</span>:<br
/><input name="url" type="text" value="http://" size="60"/></td></tr>
<?php if($image_enabled=="yes"){ ?>
<tr>
<td class="bodymd">Image URL: (Images size 125x100 pixels)<br />
<input type="text" name="image" size="60" value="<?php echo
$image; ?>" maxlength="100"/></td></tr>
<?php } ?>
<tr><td class="bodymd"Email:<br /><input type="text" name="email"
size="50"/></td></tr>
<tr><td class="bodymd"Password:<br /><input type="password"
name="password" size="10"/></td></tr>
<tr><td class="bodymd"><span style="color:#FF0000;">*</span-
indicates required field</td></tr>
<tr><td><input type="hidden" name="date_added" value="<?php echo
$date_added; ?>"/><input type="submit" name="submit" value="Add Link"/>
</td></tr>
</table>
</form>
<?php
}
else if($ax=="insert")
{
$cat_id=$_POST["cat_id"];
$name=$_POST["name"];
$dsc=$_POST["dsc"];
$url=$_POST["url"];
$email=$_POST["email"];
$password=$_POST["password"];
$date_added=$_POST["date_added"];
$image=$_POST["image"];
if($admin_approved=="no")
{
$approved="no";
}
else
{
$approved="yes";
}
$result=MySQLQuery("insert into links
(cat_id,name,dsc,url,approved,email,password,date_ added,image,rating,rates)
values
('$cat_id','$name','$dsc','$url','$approved','$ema il','$password','$date_added','$image','0','0')",$ QueryError_Email,$QueryError_Browser);
if ($result)
{
mail("$admin_mail", "Link submitted to ".$site_title."", "The link
".$name." is waiting for approval at ".$site_title."", "From:
".$admin_mail."");
if ($email && $password)
{
mail($email, "Link submitted to ".$site_title."","Your link is
waiting for approval at ".$site_title.".\nTo update you listing in the
future, login with
\n\nURL:".$url."\nEmail:".$email."\nPassword:".$pa ssword."\n\nThanks
for your submission", "From: ".$noreply_mail."");
}
echo "<p class=\"bodylgbold\">The Link Was Added</p>";
echo "<p class=\"bodysm\"><a href=\"".$PHP_SELF."\">Home</a&gt; <a
href=\"".$PHP_SELF."?ax=add\">Add a Link</a&gt; Link Added</p>";
if($admin_approved=="no")

--------------------Instead or writting the below "echo"s it should go
to me desired page-----------
{
echo "<p class=\"bodymd\">Your link request has been sent to the
site administrator for approval.</p>";
echo "<p class=\"bodymd\">An email has also been sent to you
regarding your login information should you choose to edit your listing
in the future.</p>";
}
else
{
echo "<p class=\"bodymd\">Your link has been added to the
directory.</p>";
echo "<p class=\"bodymd\">An email has also been sent to you
regarding your login information should you choose to edit your listing
in the future.</p>";
}
}
else
{
echo "<p class=\"bodysm\"><a href=\"".$PHP_SELF."\">Home</a&gt; <a
href=\"".$PHP_SELF."?ax=add\">Add a Link</a&gt; Error Adding Link</p>
<p class=\"bodylgbold\">Error Adding Link</p>";
}
}

//////////////////////////////
// Login and Editing Functions
//////////////////////////////

else if($ax=="login")
{
?>
<p class="bodylgbold">Edit Your Listing</p>
<p class="bodysm"&gt; <a href="<?php echo $PHP_SELF; ?>">Home</a>
&gt; Edit Login</p>
<form action="<?php echo $PHP_SELF; ?>?ax=editlogin" method="post"
id="form" onsubmit="return validate_login();">
<table border="0" width="100%" cellspacing="2" cellpadding="0">
<tr><td class="bodymd">URL<span style="color:#FF0000;">*</span>:<br
/><input name="url" type="text" value="http://" size="60"/></td></tr>
<tr><td class="bodymd">Email<span style="color:#FF0000;">*</span>:<br
/><input type="text" name="email" size="60"/></td></tr>
<tr><td class="bodymd">Password<span
style="color:#FF0000;">*</span>:<br /><input type="password"
name="password" size="60"/></td></tr>
<tr><td class="bodymd"><span style="color:#FF0000;">*</span-
indicates required field</td></tr>
<tr><td><input type="submit" name="submit" value="Login"/></td></tr>
<tr><td class="bodymd"><a href="<?php echo $PHP_SELF;
?>?ax=remind">Forget your login info?</a></td></tr>
</table>
</form>
<?php
}
else if($ax=="editlogin")
{
$result=MySQLQuery("select * from links where url='".$_POST["url"]."'
and email='".$_POST["email"]."' and
password='".$_POST["password"]."'",$QueryError_Email,$QueryError_Browser);
if(mysql_num_rows($result))
{
while($row=mysql_fetch_array($result))
{
$id=$row["id"];
$cat_id=$row["cat_id"];
$name=$row["name"];
$dsc=$row["dsc"];
$url=$row["url"];
$image=$row["image"];
$email=$row["email"];
$password=$row["password"];
?>
<p class="bodylgbold">Edit a Link</p>
<p class="bodysm"&gt; <a href="<?php echo $PHP_SELF; ?>">Home</a>
&gt; <a href="<?php echo $PHP_SELF."?ax=login"; ?>">Edit Login</a&gt;
Edit <?php echo $name; ?></p>
<form action="links.php?ax=update&id=<?php echo $row["id"]; ?>"
method="post" name="form" onsubmit="return validate_edit();">
<table border="0" width="100%" cellspacing="2" cellpadding="0">
<tr>
<td class="bodymd"><span style="color:#FF0000;">*</span>Category:<br
/>
<select name="cat_id">
<?php
$result=MySQLQuery("select * from links_cat where
id='$cat_id'",$QueryError_Email,$QueryError_Browse r);
while($row=mysql_fetch_array($result))
{
$temp1_id=$row["id"];
$temp1_name=$row["name"];
echo "<option value='$temp1_id'$temp1_name</option>";
}
$result=MySQLQuery("select * from links_cat where id!='$cat_id'
order by name",$QueryError_Email,$QueryError_Browser);
while($row=mysql_fetch_array($result))
{
$temp2_id=$row["id"];
$temp2_name=$row["name"];
echo "<option value='$temp2_id'$temp2_name</option>";
}
?>
</select>
</td>
</tr>
<tr><td class="bodymd">Website Name<span
style="color:#FF0000;">*</span>:<br /><input type="text" name="name"
size="60" value="<?php echo $name ?>"/></td></tr>
<tr>
<td class="bodymd">Website Description<span
style="color:#FF0000;">* <font color="#000000">(Max
255 characters)</font></span><font color="#000000">:</font>:<br
/>
<textarea name="dsc" rows="3" cols="40"><?php echo $dsc
?></textarea></td></tr>
<tr><td class="bodymd">URL<span style="color:#FF0000;">*</span>:<br
/><input type="text" name="url" size="60" value="<?php echo $url
?>"/></td></tr>
<?php if($image_enabled=="yes"){ ?>
<tr>
<td class="bodymd">Image URL: (Images size 125x100 pixels)<br />
<input type="text" name="image" size="60" value="<?php echo
$image; ?>" maxlength="100"/></td></tr>
<?php } ?>
<tr><td class="bodymd"Email:<br /><input type="text" name="email"
size="50" value="<?php echo $email ?>"/></td></tr>
<tr><td class="bodymd"Password:<br /><input type="password"
name="password" size="10" value="<?php echo $password ?>"/></td></tr>
<tr><td class="bodymd"><span style="color:#FF0000;">*</span-
indicates required field</td></tr>
<tr><td>
<input type="submit" name="update" value="Edit Link"/></td></tr>
</table>
</form>
<?php
}
}
else
{
echo "<p class=\"bodylgbold\">No Records Found</p>";
echo "<p class=\"bodymd\">No web site listing can be found with that
URL, email address or password.</p>";
echo "<p class=\"bodymd\"><a href=\"$PHP_SELF?ax=remind\">Click
here</ato get login info for all websites listed to your email
address sent to you.</p>";
}
}
else if($ax=="update")
{

$result11=MySQLQuery("select * from links where
url='".$_POST["url"]."' and email='".$_POST["email"]."' and
password='".$_POST["password"]."'",$QueryError_Email,$QueryError_Browser);
if(mysql_num_rows($result11))
{
while($row=mysql_fetch_array($result11))
{
$id=$row["id"];
$cat_id=$row["cat_id"];
$name=$row["name"];
$dsc=$row["dsc"];
$url=$row["url"];
$image=$row["image"];
$email=$row["email"];
$password=$row["password"];
$cat_id=$_POST["cat_id"];
$name=$_POST["name"];
$dsc=$_POST["dsc"];
$url=$_POST["url"];
$email=$_POST["email"];
$password=$_POST["password"];
$image=$_POST["image"];

$result=MySQLQuery("update links set cat_id='$cat_id', name='$name',
dsc='$dsc', url='$url', email='$email', password='$password',
image='$image' where id='$id'",$QueryError_Email,$QueryError_Browser);
if ($result)
{
if ($email && $password)
{
mail($email, "Link modified at ".$site_title."", "Your link has
been modified.\n\nThanks for keeping it up to date.", "From:
".$noreply_mail);
}
echo "<p class=bodylgbold>The Link Was Updated</p>";
echo "<p class=\"bodysm\"><a href=\"".$PHP_SELF."\">Home</a&gt; <a
href=\"$PHP_SELF?ax=login\">Edit Login</a&gt; Edit &gt; $name
Updated</p>";

}
else
{
echo "<p class=bodylgbold>Error Updating Link</p>";
}
}
}
}

//////////////////////////////
// Password Reminder Functions
//////////////////////////////

else if($ax=="remind")
{
?>
<p class="bodylgbold">Get Your Login Information</p>
<p class="bodymd">This will email you the login information for all
URL's that have been submitted by the requested email address</p>
<form action="<?php echo $PHP_SELF; ?>?ax=remindmail" method="post"
id="form" onsubmit="return validate_remind();">
<table border="0" width="100%" cellspacing="2" cellpadding="0">
<tr><td class="bodymd">Email:<br /><input type="text" name="email"
size="40"/></td></tr>
<tr><td><input type="submit" name="submit" value="Email My Login
Info"/></td></tr>
</table>
</form>
<?php
}
else if($ax=="remindmail")
{
$msg="";
$result=MySQLQuery("select * from links where
email='$email'",$QueryError_Email,$QueryError_Brow ser);
if(mysql_num_rows($result))
{
while($row=mysql_fetch_array($result))
{
$name=$row["name"];
$url=$row["url"];
$email=$row["email"];
$password=$row["password"];
$msg="$msg Login Information for $name is as follows:\n URL: $url\n
Email: $email\n Password: $password\n\n";
}
$msg="$msg Thank you for using $Site_Name";
mail($email, "Login information from ".$GLOBALS["Site_Name"], $msg,
"From: ".$GLOBALS["NoReply_Mail"]);
Echo "<p class=bodylgbold>Email Sent</p><p class=bodymd>Your Login
Information has been sent to $email.</p>";
}
else
{
echo "<p class=\"bodylgbold\">No Records Found</p><p
class=\"bodymd\">Sorry, no records were found registered to
$email.</p>";
}
}

//////////////////
// Main Front Page
//////////////////

else
{
$result = MySQLQuery("SELECT id,sub_cat,name FROM links_cat WHERE
sub_cat='0' ORDER BY name ASC", $QueryError_Email,$QueryError_Browser);
$count=0;
if(mysql_num_rows($result))
{
echo "<table cellpadding=\"0\" cellspacing=\"0\"
style=\"border-style:none;width:100%;\">\n";
while($row=mysql_fetch_array($result))
{
$count=$count+1;
$id=$row["id"];
$sub_cat=$row["sub_cat"];
$name=$row["name"];
$dsc=$row["dsc"];
$link_count = MySQLQuery("SELECT * FROM links WHERE
cat_id='".$id."' AND approved='yes' ORDER BY name ASC",
$QueryError_Email,$QueryError_Browser);
$link_count=mysql_num_rows($link_count);
if($link_count==1){$link_text="link";}else{$link_t ext="links";}
if($count <= $front_cols && $count==1){echo "<tr>\n<td
align=\"left\" valign=\"top\" style=\"width:$front_perc;\">\n";}
else if($count < $front_cols && $count 1){echo "<td
class=\"bodymd\">&nbsp;&nbsp;</td>\n<td align=\"left\" valign=\"top\"
style=\"width:$front_perc;\">\n";}
else if($count==$front_cols){echo "<td
class=\"bodymd\">&nbsp;&nbsp;</td>\n<td align=\"left\" valign=\"top\"
style=\"width:$front_perc;\">\n";}
echo "<span class=\"categorylinks\"><a
href=\"$PHP_SELF?ax=list&amp;sub=$id&amp;cat_id=$i d\">$name
($link_count $link_text)</a></span><br />\n";
$result2 = MySQLQuery("SELECT id,sub_cat,name FROM links_cat WHERE
sub_cat='$id' ORDER BY name ASC",
$QueryError_Email,$QueryError_Browser);
if(mysql_num_rows($result2))
{
echo "<ul class=\"bodysm\">";
while($row2=mysql_fetch_array($result2))
{
$id2=$row2["id"];
$sub_cat2=$row2["sub_cat"];
$name2=$row2["name"];
$link_count = MySQLQuery("SELECT * FROM links WHERE
cat_id='".$id2."' AND approved='yes' ORDER BY name ASC",
$QueryError_Email,$QueryError_Browser);
$link_count=mysql_num_rows($link_count);
if($link_count==1){$link_text="link";}else{$link_t ext="links";}
echo "<li><a
href=\"$PHP_SELF?ax=list&amp;sub=$sub_cat2&amp;cat _id=$id2\">$name2
($link_count $link_text)</a></li>\n";
}
echo "</ul>";
}
if($count <= $front_cols && $count==1){echo "<br /><br
/>\n</td>\n";}
else if($count < $front_cols && $count 1){echo "<br /><br
/>\n</td>\n";}
else if($count==$front_cols){echo "<br /><br />\n</td>\n";}
if($count==$front_cols){$count=0;}
}
if($count < $front_cols)
{
$spacer=($front_cols - $count) * 2;
echo "\n<td class=\"bodymd\"
colspan=\"$spacer\">&nbsp;&nbsp;</td>\n";
}
echo "</tr>\n</table>\n";
}
else
{
echo "<p class=\"bodymd\">No categories found</p>";
}
}
include('footer.php');
ob_end_flush();
?>


and so on.... Does this help?

casper

Nov 17 '06 #9

P: n/a
Hi

well after screwing around I found out how to make it work. thanks..
but....

Now I found out the first code...getting the database id....isn't
really working:(

It writes the id as "123" everytime. How else can i get the id. I can
see the id in the admin panel, so it writes it somehow..

any good ideas

Casper

Nov 17 '06 #10

P: n/a
casper christensen wrote:
Hi

well after screwing around I found out how to make it work. thanks..
but....

Now I found out the first code...getting the database id....isn't
really working:(

It writes the id as "123" everytime. How else can i get the id. I can
see the id in the admin panel, so it writes it somehow..

any good ideas

Casper
Casper,

That's an awful lot of code to go through to find a problem like that.
Do you have it on a web page so we can see what you're getting? It's
hard to test it here without your database...

Also, when I get strange problems like this I just start commenting out
the code - make it as simple as possible. An alternative is to put echo
statements at critical points in your code (i.e. in loops where you're
retrieving the value) to see what it shows. It's helped me find a lot
of nasty bugs. Note that depending on where it is in the html and what
browser you're using, you may have to look at your page source to see
the output.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #11

P: n/a
Hi

well, I have no idea what you're talking about:)

I don't know anything about php, but i guess the problem in writting:

http://www.affiliatesjunction.net/directory.php?ax=out&id=<?=$id?>

wich was the first idea, is that it doesn't really say what id. right?

just tell me exactly what you need to figure out this problem and I'll
do my best!

sincerely
Casper

thanks for helping me out guys!:)

Jerry Stuckle skrev:
casper christensen wrote:
Hi

well after screwing around I found out how to make it work. thanks..
but....

Now I found out the first code...getting the database id....isn't
really working:(

It writes the id as "123" everytime. How else can i get the id. I can
see the id in the admin panel, so it writes it somehow..

any good ideas

Casper

Casper,

That's an awful lot of code to go through to find a problem like that.
Do you have it on a web page so we can see what you're getting? It's
hard to test it here without your database...

Also, when I get strange problems like this I just start commenting out
the code - make it as simple as possible. An alternative is to put echo
statements at critical points in your code (i.e. in loops where you're
retrieving the value) to see what it shows. It's helped me find a lot
of nasty bugs. Note that depending on where it is in the html and what
browser you're using, you may have to look at your page source to see
the output.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #12

P: n/a
casper christensen wrote:
Jerry Stuckle skrev:
>>casper christensen wrote:
>>>Hi

well after screwing around I found out how to make it work. thanks..
but....

Now I found out the first code...getting the database id....isn't
really working:(

It writes the id as "123" everytime. How else can i get the id. I can
see the id in the admin panel, so it writes it somehow..

any good ideas

Casper

Casper,

That's an awful lot of code to go through to find a problem like that.
Do you have it on a web page so we can see what you're getting? It's
hard to test it here without your database...

Also, when I get strange problems like this I just start commenting out
the code - make it as simple as possible. An alternative is to put echo
statements at critical points in your code (i.e. in loops where you're
retrieving the value) to see what it shows. It's helped me find a lot
of nasty bugs. Note that depending on where it is in the html and what
browser you're using, you may have to look at your page source to see
the output.

Hi

well, I have no idea what you're talking about:)

I don't know anything about php, but i guess the problem in writting:

http://www.affiliatesjunction.net/directory.php?ax=out&id=<?=$id?>

wich was the first idea, is that it doesn't really say what id. right?

just tell me exactly what you need to figure out this problem and I'll
do my best!

sincerely
Casper

thanks for helping me out guys!:)

(Top posting fixed)

You code will only work if you have short_tags turned on (in your
php.ini file). That's not generally the case any more (for one thing it
conflicts with XML).

Rather, you are correct in your code when you use:

...<?php echo $id; ?>

As to which id it's using - it depend on where you put it. But I found
three similar lines in your code, so I'm not sure which one you're
referring to.

Also, you might want to either learn PHP or hire a consultant to give
you a hand. I think you've may have bitten off more than you can chew
right now.

As for getting the correct ID - I'm confused as to where you mean
because of the multiple similar lines in your code.

Which page does is your code for? It might help if I could look at the
failing page.

Also, here on Usenet, we help people - but those people also need to be
helping themselves. We'll help with specific questions, we'll refer you
to documents as appropriate, and help you out as much as possible. But
this stops at trying to find a bug in several hundred lines of code. I
don't have the several hours it could take to chase down a bug in that
large of a chunk of code, and I doubt many people here do. I'd have to
recreate your database, load it with data, then start testing.

That's why I suggested you do some initial debugging on your own -
something anyone who uses PHP needs to learn to do anyway.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #13

P: n/a
I'm not asking you or anyone to go throught the entire code to find a
bug. There is no bug!
I need to know how to fetch the created Id. The must be some "standard"
code to get "load" values from the database.

casper

Nov 17 '06 #14

P: n/a
casper christensen wrote:
I'm not asking you or anyone to go throught the entire code to find a
bug. There is no bug!
I need to know how to fetch the created Id. The must be some "standard"
code to get "load" values from the database.

casper
I'm not sure what you mean by fetch the "created id". Are you talking
about after your user adds a new row to the table? If that's the case,
see http://www.php.net/manual/en/functio...-insert-id.php.

But you're also not using "standard" MySQL functions. MySQLQuery is not
a PHP function. The one defined in PHP is mysql_query. I have no idea
what your function is doing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #15

P: n/a
Well

Using the insert tag, it returns the value"0", any idea why. Obviously
it doesnt get the last inserted id (tried Last_insert_id.. too)

casper

Jerry Stuckle skrev:
casper christensen wrote:
I'm not asking you or anyone to go throught the entire code to find a
bug. There is no bug!
I need to know how to fetch the created Id. The must be some "standard"
code to get "load" values from the database.

casper

I'm not sure what you mean by fetch the "created id". Are you talking
about after your user adds a new row to the table? If that's the case,
see http://www.php.net/manual/en/functio...-insert-id.php.

But you're also not using "standard" MySQL functions. MySQLQuery is not
a PHP function. The one defined in PHP is mysql_query. I have no idea
what your function is doing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #16

P: n/a
casper christensen wrote:
Well

Using the insert tag, it returns the value"0", any idea why. Obviously
it doesnt get the last inserted id (tried Last_insert_id.. too)

casper

Jerry Stuckle skrev:
>>casper christensen wrote:
>>>I'm not asking you or anyone to go throught the entire code to find a
bug. There is no bug!
I need to know how to fetch the created Id. The must be some "standard"
code to get "load" values from the database.

casper

I'm not sure what you mean by fetch the "created id". Are you talking
about after your user adds a new row to the table? If that's the case,
see http://www.php.net/manual/en/functio...-insert-id.php.

But you're also not using "standard" MySQL functions. MySQLQuery is not
a PHP function. The one defined in PHP is mysql_query. I have no idea
what your function is doing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

First of all, does the table have an autonumber column? Since you were
looking for an ID, I suspected it did, but my assumption may be wrong.

Also, did you call it after making the insert, using the same connection
as the INSERT (and without closing the connection)?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #17

P: n/a
Please do me a favour and try to add a link at my site, then you'll see
what I need and you might be able to help me

http://www.affiliatesjunction.net/directory.php?ax=add
This will take you to the form
casper
Jerry Stuckle skrev:
casper christensen wrote:
Well

Using the insert tag, it returns the value"0", any idea why. Obviously
it doesnt get the last inserted id (tried Last_insert_id.. too)

casper

Jerry Stuckle skrev:
>casper christensen wrote:

I'm not asking you or anyone to go throught the entire code to find a
bug. There is no bug!
I need to know how to fetch the created Id. The must be some "standard"
code to get "load" values from the database.

casper
I'm not sure what you mean by fetch the "created id". Are you talking
about after your user adds a new row to the table? If that's the case,
see http://www.php.net/manual/en/functio...-insert-id.php.

But you're also not using "standard" MySQL functions. MySQLQuery is not
a PHP function. The one defined in PHP is mysql_query. I have no idea
what your function is doing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

First of all, does the table have an autonumber column? Since you were
looking for an ID, I suspected it did, but my assumption may be wrong.

Also, did you call it after making the insert, using the same connection
as the INSERT (and without closing the connection)?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #18

P: n/a
casper christensen wrote:
There is no bug!
LOL, why doesn't it work then?
Do you call the reason for the non-functioning a "feature"?
I need to know how to fetch the created Id. The must be some "standard"
code to get "load" values from the database.
Try this:

<?php
define('DB_HOST', '127.0.0.1'); ### change
define('DB_USER', 'nonroot'); ### these
define('DB_PASS', 'password'); ### define's
define('DB_DATA', 'example'); ### to match
define('YOURTABLE', 'data'); ### your configuration
define('TESTTABLE', 'test');

$conn = mysql_connect(DB_HOST, DB_USER, DB_PASS)
or die('Connection error.');
if (!mysql_select_db(DB_DATA)) die('Database error.');
$sql = "create table " . TESTTABLE .
" (test_id int not null primary key auto_increment," .
" test_val int)";
if (!mysql_query($sql)) die('Create table failed.');
$sql = "insert into " . TESTTABLE . " (test_val) values (42)";
if (!mysql_query($sql)) die('Insert failed');
echo 'Last id created was: ' . mysql_insert_id() . "<br>\n";
mysql_close($conn);
?>
--
I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.
Nov 17 '06 #19

P: n/a
casper christensen wrote:
Jerry Stuckle skrev:
>>casper christensen wrote:
>>>Well

Using the insert tag, it returns the value"0", any idea why. Obviously
it doesnt get the last inserted id (tried Last_insert_id.. too)

casper

Jerry Stuckle skrev:
casper christensen wrote:
>I'm not asking you or anyone to go throught the entire code to find a
>bug. There is no bug!
>I need to know how to fetch the created Id. The must be some "standard"
>code to get "load" values from the database.
>
>casper
>

I'm not sure what you mean by fetch the "created id". Are you talking
about after your user adds a new row to the table? If that's the case,
see http://www.php.net/manual/en/functio...-insert-id.php.

But you're also not using "standard" MySQL functions. MySQLQuery is not
a PHP function. The one defined in PHP is mysql_query. I have no idea
what your function is doing.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

First of all, does the table have an autonumber column? Since you were
looking for an ID, I suspected it did, but my assumption may be wrong.

Also, did you call it after making the insert, using the same connection
as the INSERT (and without closing the connection)?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Please do me a favour and try to add a link at my site, then you'll see
what I need and you might be able to help me

http://www.affiliatesjunction.net/directory.php?ax=add
This will take you to the form
casper

(Top posting fixed)

Ok, I tried it. But first of all, you have what could be a problem on
this page. In it, you have:

<form action="/directory.php?ax=insert" method="post" ...>

Here you're performing a POST operation, but passing a parameter
(ax=insert) as a GET parameter. This isn't good, and may not work in
all instances. If you want to pass the parameter, a much better way
would be to pass it as a hidden field, i.e., in your form have:

<input type="hidden" name="ax" value="insert">

Secondly, after I add the row, your next page comes back with two
complete pages - DOCTYPE and all. Obviously not good at all.

Now, I see were you're saying the insert id is zero. But not being able
to see the actual insert code or database, it's impossible to tell
exactly what's going on. I have no idea, for instance, where you placed
the code to get the insert id.

Additionally, you're using some other functions - MySQLQuery, for
instance - which aren't part of the native interface to MySQL and I have
no idea what they do. Do they, for instance, open a connection, do the
insert, then close the connection? I have no idea because you never
showed that code.

Additionally, does the database have an autonum column? It needs to in
order to get an insert id. Again, I don't know, because you haven't
posted the database schema.

We need to know all of these things in order to be able to better tell
what's going on.

P.S. Please don't top post!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 17 '06 #20

P: n/a
casper christensen wrote:
Well

Using the insert tag, it returns the value"0", any idea why. Obviously
it doesnt get the last inserted id (tried Last_insert_id.. too)

It may be that the connection was reused by your server.
You have to make sure that the INSERT was the LAST
command on the connection.

Because of this little gotcha, I've had to abandon
AUTO_INCREMENT as a PRMARY KEY altogether,
generating my own PK instead (on MYSQL).
Nov 17 '06 #21

P: n/a
Well, I don't think we'll get anywhere going on like this...I don't
have a clue what you're talking about.

But... I might have found another approach:

Try going to the site (http://www.affiliatesjunction.net) and click
edit program.

type in:

url: http://test.com
email: te**@test.com
password: test

See the last textfield shows exactly what I want it to show using this
code:

http://www.affiliatesjunction.net/directory.php?ax=out&id=<?=$id?>

Because It "finds" the right id when putting in the url,email and
password right?

Can we use this somehow? Maybe I can "just" ad something simular to the
"echo" codes
It originally uses after submitting.

Casper

Nov 17 '06 #22

P: n/a
Please..anyone...I'm so alone....:)

Nov 18 '06 #23

P: n/a
Message-ID: <11**********************@h54g2000cwb.googlegroups .comfrom
casper christensen contained the following:
>Please..anyone...I'm so alone....:)
That'll probably continue until you learn to post properly. Quote
sufficient of the previous message to give context and then place your
reply below. Or if the message contains multiple points,
intersperse.your replies.

I think it may be a good idea for you to take stock and summarise your
position, including telling us what you've tried, showing code examples
where necessary.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Nov 18 '06 #24

This discussion thread is closed

Replies have been disabled for this discussion.