PHP Web Host - Quality Web Hosting For All PHP Applications Clan Themes! We make clans look good!!
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Tue Aug 03, 2004 1:30 pm Reply with quote Back to top

I'm making a module... I've got some problems... I hope someone will help...

1. Why isn't this working...

Code:

$result5 = $db->sql_query("SELECT title, tid  FROM ".$prefix."_reviews where title='$mypage[title]' AND eid='3'");   
$row5 = $db->sql_fetchrow($result5);
$solucja = $row5['title'];
$stid = $row5['tid'];

echo "<br><b>Tipsy:</b><br> ";
       echo "<a href=modules.php?name=Encyclopedia&op=content&tid=$stid><font color=yellow><strong><big>&middot;</big></strong>$solucja</font></a>";



It's working when I cut out the AND eid='3' part... But I want to work with it...

2. How to make a loop... I've got this code above...
And I want it to show all the things from the table that are right according to the querry...

3. The querry above compares the titles from two tables... But it won't work if the titles are a bit different for example... It won't work if one Title is DOOM 3 and the other title is DOOM3 (PC)... Can I somehow do a querry that will work with similar titles...

Please help... I'm trying to do it for hours... Please help...


Last edited by Bigboy177 on Tue Aug 03, 2004 3:11 pm; edited 1 time in total
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Tue Aug 03, 2004 2:20 pm Reply with quote Back to top

You'll want to read up on MySQL joins if its from 2 tables. You could also try using LIKE to find close matches. Something like this:
where title like '%$mypage[title]%'
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 03, 2004 2:40 pm Reply with quote Back to top

For the title compare, you might want to explore the soundex() function. Something like
Code:
"SELECT * FROM table1 t1, table2 t2 WHERE soundex(t1.title) =  soundex(t2.title)";

You could also use the substr() function to only compare the first 4 or 5 bytes of each title or even wrap the soundex() in a substr().
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Tue Aug 03, 2004 2:51 pm Reply with quote Back to top

But what about, the loops... and what about the code... Why doesn't it work...
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 03, 2004 3:21 pm Reply with quote Back to top

Well, on the #1, you are asking for eid = '3'. i don't find a column like that (eid), however there is a TID.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Tue Aug 03, 2004 3:28 pm Reply with quote Back to top

I would like to ask for $title and $tid from the line:
in which the $title='$mypage[title]' and the $eid value is 3... I don't want to see lines in which eid=2 or eid=5 just eid=3...
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 03, 2004 3:29 pm Reply with quote Back to top

But there is no column called EID on that table.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Tue Aug 03, 2004 3:46 pm Reply with quote Back to top

Ups... I overlooked that... Thanks Raven... It's supposed to be an other table... Bang Head

I've got another question...
I want to make a button...
I've put this code into the module... But the page doesn't show at all after adding it... Not after I press the button... but while loading the page with button...

The button code:
Code:

echo "<input type=\"hidden\" name=\"pa\" value=\"vote\">
    <input type=\"submit\" value=\"Głosuj\">


Than the function:

Code:

function vote($scoreusr, $votes){

include ('header.php');
   OpenTable();
   $db->sql_query("UPDATE ".$prefix."_score_user SET scoreusr=scoreusr+".$scoreuser."");
   echo "<b>Dziękujemy za twój głos...</b>"
   CloseTable();
   include("footer.php");
}


And the case...
Code:

case "vote":
    vote($scoreusr, $votes);
    break;


Maybe you will be able to help... I don't know where the mistake is... Sad
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 03, 2004 3:52 pm Reply with quote Back to top

Not sure just what you're after here, but you have " w/i " which is causing it to die. Try this ("UPDATE ".$prefix."_score_user SET scoreusr=(scoreusr+'$scoreuser'");
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
antinportugal
Hangin' Around


Joined: Feb 24, 2004
Posts: 31

PostPosted: Tue Aug 03, 2004 4:09 pm Reply with quote Back to top

ignore this post: by the time i had posted my reponse the topic had aleady moved on Cool i would have deleted it if allowed that option Laughing

if I make a squeak here Smile

i think the eid is referring to a column in the encyclopedia table (nuke_encyclopedia) , sixonetonoffun has already mentioned above about joining tables so I will say no more Smile apart from : Bigboy177 what module are you trying to make?


Last edited by antinportugal on Tue Aug 03, 2004 4:26 pm; edited 1 time in total
View user's profile Send private message Send e-mail
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Tue Aug 03, 2004 4:18 pm Reply with quote Back to top

I'm making a module that will display related stuff on My site... When I select a name, from the list... It'll display everything that is related...
View user's profile Send private message
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Tue Aug 03, 2004 4:29 pm Reply with quote Back to top

The Module is now working... Thanks Raven... But the button isn't...
Maybe you can suggest the code I could use... to make a button, to run a specific function...
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Tue Aug 03, 2004 6:23 pm Reply with quote Back to top

<input type="button" onClick="doSomething()">
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 5:43 am Reply with quote Back to top

Raven wrote:
<input type="button" onClick="doSomething()">


So what should I put instead of "doSomething()" to call a function preview_baza in that module...
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Wed Aug 04, 2004 5:46 am Reply with quote Back to top

preview_baza()
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 5:55 am Reply with quote Back to top

So how should the whole button code look like...
With the name... Bacuse I inserted something like this...

Code:

echo "<input type="button" onClick="preview_baza()" value=\"Podgląd\">"
        ."</form>";[/b]


And now the page won't load... Sad
View user's profile Send private message
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 6:00 am Reply with quote Back to top

OK. I fixed the button... But when I press on it... nothing happens... Sad
View user's profile Send private message
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 6:10 am Reply with quote Back to top

I've got two buttons... Maybe it's because of that...

This is how the buttons code looks like...

Code:

 echo "<input type=\"submit\" value=\"Submit\">"
        ."</form>";
       
    echo "<input type=\"button\" onClick=\"preview_baza()\" value=\"Preview\">";


The first button is working... But the second isn't... Sad
Please help... I've been trying to fix this for so long now... Sad
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Wed Aug 04, 2004 6:20 am Reply with quote Back to top

First of all you need to place all form elements inside of the <form> </form> tags. Try that and see if that helps.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 6:35 am Reply with quote Back to top

Still nothing... The first button is working... the second isn't... Sad
Maybe I need to define these button somewhere...
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Wed Aug 04, 2004 6:44 am Reply with quote Back to top

The syntax is correct. If nothing is happening then I would suspect that your function is not working.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
chatserv
The Mouse Is Extension Of Arm


Joined: May 02, 2003
Posts: 1396
Location: Puerto Rico

PostPosted: Wed Aug 04, 2004 6:54 am Reply with quote Back to top

Quote:
function vote($scoreusr, $votes){

include ('header.php');
OpenTable();
$db->sql_query("UPDATE ".$prefix."_score_user SET scoreusr=scoreusr+".$scoreuser."");
echo "<b>Dziękujemy za twój głos...</b>" Shouldn't there be a semi-colon in here?
CloseTable();
include("footer.php");
}
View user's profile Send private message Visit poster's website
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 7:30 am Reply with quote Back to top

Yes it should... this function thu is working OK...
Now I'm trying to modify a Conteudo module... because there's no preview in it...

And i think I won't do it...

I've changed my function to something like this:

Code:

function preview_baza() {
    global $prefix, $db, $sitename, $admin, $module_name, $config;
    include ('header.php');
    OpenTable();
       echo "<b><font color=00b7eb><center>Ocena Gry</center></font></b><br><br><hr>";
       echo "<center><b>Grafika:</b><br>";
    CloseTable();
   include("footer.php");



And it still isn't working... maybe it's because of this line... At the bigning of the function in which I want this button to be:

Code:

echo "<form action=\"modules.php?name=$module_name&amp;file=admin\" method=\"post\">";


the [/form] tag is ending right after the first button which is working...

I've opened another <form> tag and closed it after my new button... But I didn't write anything like <form action=....>

Maybe I could post the entire module code... maybe then you will be able to help me...
View user's profile Send private message
sixonetonoffun
Spouse Contemplates Divorce


Joined: Jan 02, 2003
Posts: 2499

PostPosted: Wed Aug 04, 2004 8:38 am Reply with quote Back to top

If you do just upload it and post an url to the file/'s rather then post the whole page here.
View user's profile Send private message
Bigboy177
Worker
Worker


Joined: Jul 07, 2004
Posts: 192

PostPosted: Wed Aug 04, 2004 9:08 am Reply with quote Back to top

I've finally managed to do this button... And It's working... but when I press it, it displays an empty preview page... everytable is on it's place, but there's no data I've written....

Here is the code that finally worked with the button...
Code:

echo "<form action=\"modules.php?name=$module_name&amp;file=admin\" method=\"post\">";
    echo "<br><br><input type=\"submit\" name=\"op\" value=\""._PREVIEW."\">&nbsp;&nbsp;</form>";


I don't know if it's perfectly OK, so I've uploaded the module so you can check it for me if you have time... I think it's not so hard to do... But I'm a total noob... so I can't figure out what's wrong... why doesn't it show the preview contents...

Only registered users can see links on this board!
Get registered or login to the forums!


Please Help Me... I think it's not too hard to fix it... But I don't know PHP that well...
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum