function displaying as undefined?? helllp!!!
Moderator: General Moderators
function displaying as undefined?? helllp!!!
I hope someone can help, Im having problems adding a javascript gallery to a php site...it doesnt work, and i cant figure out why not......???
this is my header section, where I have linked the css and javascript files (to the page contents php file)
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.galleria.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$PATH_TO_CSS?>gallery.css" />
<script type="text/javascript" href="<?=$PATH_TO_CSS?>">
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>
<?php
this is my page content function......php
function get_content_bboys()
{
//$query = ("SELECT *FROM bboys WHERE id = bboys);
//echo $query;
//$result = mysql_query($query);
$result = mysql_query("SELECT *FROM bboys WHERE id = bboys");
$content = "<div class='demo'>\n";
$content .= "<ul class='skratch_gallery'>\n";
$content .= "<li'>\n";
while ($row = mysql_fetch_array($result));
{
$content .= "<a href='index.php?p=bboys" . $row['id'] . "' title='" . $row['name'] . "'>
<img src='/skratch/bboys/" . $row['img_file'] . "' alt='" . $row['name'] . "' />
</a>\n";
}
$content .= "</li'>\n";
$content .= "</ul>\n";
$content .= "</div>\n";
return $content;
}
this is my url...
http://www.teragraphix.com/skratch/index.php?p=bboys
this is my header section, where I have linked the css and javascript files (to the page contents php file)
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.galleria.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$PATH_TO_CSS?>gallery.css" />
<script type="text/javascript" href="<?=$PATH_TO_CSS?>">
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>
<?php
this is my page content function......php
function get_content_bboys()
{
//$query = ("SELECT *FROM bboys WHERE id = bboys);
//echo $query;
//$result = mysql_query($query);
$result = mysql_query("SELECT *FROM bboys WHERE id = bboys");
$content = "<div class='demo'>\n";
$content .= "<ul class='skratch_gallery'>\n";
$content .= "<li'>\n";
while ($row = mysql_fetch_array($result));
{
$content .= "<a href='index.php?p=bboys" . $row['id'] . "' title='" . $row['name'] . "'>
<img src='/skratch/bboys/" . $row['img_file'] . "' alt='" . $row['name'] . "' />
</a>\n";
}
$content .= "</li'>\n";
$content .= "</ul>\n";
$content .= "</div>\n";
return $content;
}
this is my url...
http://www.teragraphix.com/skratch/index.php?p=bboys
Re: function displaying as undefined?? helllp!!!
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/terra12/public_html/skratch/includes/page_contents.php on line 203
You need to connect to a database before doing the select query.
You need to connect to a database before doing the select query.
Re: function displaying as undefined?? helllp!!!
I am connected through my config file....
http://www.teragraphix.com/skratch/index.php?p=tshirts
this is connected to the database...its weird
http://www.teragraphix.com/skratch/index.php?p=tshirts
this is connected to the database...its weird
Re: function displaying as undefined?? helllp!!!
Pop a space in between * and FROM in your SQL query.
Re: function displaying as undefined?? helllp!!!
What's
Try
[sql]SELECT * FROM bboys WHERE id = 'bboys'[/sql]
bboys???"SELECT *FROM bboys WHERE id = bboys"
Try
[sql]SELECT * FROM bboys WHERE id = 'bboys'[/sql]
There are 10 types of people in this world, those who understand binary and those who don't
Re: function displaying as undefined?? helllp!!!
i think its something to do with the " in the header section where the jquery is defined....
///ile highlight in red where the " are in the css links, and then it will show that Im not sure where the " goes for the jquery
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?> /// DOES IT GO HERE??
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>/// DOES IT GO HERE??
<?php
///ile highlight in red where the " are in the css links, and then it will show that Im not sure where the " goes for the jquery
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?> /// DOES IT GO HERE??
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>/// DOES IT GO HERE??
<?php
Re: function displaying as undefined?? helllp!!!
awesome!! that got rid of one prob, thnx!!!VladSun wrote:What'sbboys???"SELECT *FROM bboys WHERE id = bboys"
Try
[sql]SELECT * FROM bboys WHERE id = 'bboys'[/sql]
Re: function displaying as undefined?? helllp!!!
ok i figured out i dont need a link to an file...as its a function on its own...so ive taken out the link, and its this
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.galleria.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$PATH_TO_CSS?>gallery.css" />
<script type="text/javascript">
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>
<?php
}
?>
I dont have a clue whats wrong with it tho, theres an image on the database so it should be displaying that at least, I want to break something lol...
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.galleria.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$PATH_TO_CSS?>gallery.css" />
<script type="text/javascript">
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>
<?php
}
?>
I dont have a clue whats wrong with it tho, theres an image on the database so it should be displaying that at least, I want to break something lol...
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Re: function displaying as undefined?? helllp!!!
Can you please start using the
Code: Select all
tags when posting code. Even better would be if you usedCode: Select all
as it formats the code you post nicely as PHP code. Thanks.Re: function displaying as undefined?? helllp!!!
can anyone help me to make this work??
my header links...
http://www.teragraphix.com/skratch/index.php?p=bboys
my header links...
Code: Select all
<?php
if($_GET['p']=="bboys"){ ?>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.js"></script>
<script type="text/javascript" href="<?=$PATH_TO_CSS?>jquery.galleria.pack.js"></script>
<link rel="stylesheet" type="text/css" href="<?=$PATH_TO_CSS?>gallery.css" />
<script type="text/javascript">
jQuery(function($) {
$('.skratch_gallery').addClass('gallery_class'); // adds new class name to maintain degradability
$('.nav').css('display','none'); // hides the nav initially
$('ul.gallery_class').galleria({
history : false, // deactivates the history object for bookmarking, back-button etc.
clickNext : true, // helper for making the image clickable. Let's not have that in this example.
insert : undefined, // the containing selector for our main image.
// If not found or undefined (like here), galleria will create a container
// before the ul with the class .galleria_container (see CSS)
onImage : function() { $('.nav').css('display','block'); } // shows the nav when the image is showing
});
});
</script>
<?php
}
?>
Code: Select all
function get_content_bboys()
{
//$query = ("SELECT * FROM bboys WHERE id = 'bboys'");
//echo $query;
//$result = mysql_query($query);
$result = mysql_query("SELECT * FROM bboys WHERE id = 'bboys'");
$content = "<div class='demo'>\n";
$content .= "<ul class='skratch_gallery'>\n";
$content .= "<li'>\n";
while ($row = mysql_fetch_array($result));
{
$content .= "<a href='index.php?p=bboys" . $row['id'] . "' title='" . $row['name'] . "'>
<img src='/skratch/bboys/" . $row['img_file'] . "' alt='" . $row['name'] . "' />
</a>\n";
}
$content .= "</li'>\n";
$content .= "</ul>\n";
$content .= "</div>\n";
return $content;
}
Re: function displaying as undefined?? helllp!!!
erm , i dont understand