| Help |
| Author | Text |
slashado Donator
Posts: 282

Gender:  Online: No
Version: 4.0.1 Country: Brasil Languages: Português, Inglês (via Google), e todas as outras (via google) |
Date: 02/07/2009 03:01 Help | #post20977 | Mem .. I made a block, and even a Addon that makes the connection to the DB MemHT. the problem is that I did not use the Global Settings for connecting, say, where was I wrong here?
Take a quick look at me:
| code | <?php
if (stristr(htmlentities($_SERVER['PHP_SELF']), "block_patrocinios_top.php")) {
die("Error: This file cannot be opened directly!");
}
$hostname_bloco = "localhost";
$database_bloco = "mscriacoes";
$username_bloco = "marcio";
$password_bloco = "261902";
$bloco = mysql_pconnect($hostname_bloco, $username_bloco, $password_bloco) or trigger_error(mysql_error(),E_USER_ERROR);
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_bloco, $bloco);
$query_bloco = "SELECT * FROM memht_banner_top ORDER BY id ASC";
$bloco = mysql_query($query_bloco, $bloco) or die(mysql_error());
$row_bloco = mysql_fetch_assoc($bloco);
$totalRows_bloco = mysql_num_rows($bloco);
echo "<script type='text/javascript' src='inc/javascript/jquery/jquery.js'></script>\n";
echo "<script type='text/javascript' src='inc/javascript/jquery/plugins/cycle/jquery.cycle.js'></script>\n";
?>
<script type="text/javascript">
$(document).ready(function() {
$('.pics1').cycle({
fx: 'growY',
timeout: 6000,
delay: -2000,
pause: 1
});
});
</script>
<div align="right">
<div class="pics1" style="height:125px; width:585px;">
<?php do { ?>
<a href="<?php echo $row_bloco['link']; ?>" alt="<?php echo $row_bloco['descricao']; ?>" title="<?php echo $row_bloco['descricao']; ?>" target="<?php echo $row_bloco['target']; ?>"><img src="uploads/image/patrocinios/<?php echo $row_bloco['imagem']; ?>" width="585" height="125" border="0" align="absbottom" /></a>
<?php } while ($row_bloco = mysql_fetch_assoc($bloco)); ?></div> |
I tried to use the global $ dblink, but failed, I lost what to do, then I am here asking for help. What should I do to get the connection to adapt memHT you do not have to be creating connection to the DB at all?
Thank you. |
|
 |
| |
mem MemHT's Dad Admin & Developer

Posts: 6824

Gender:  Online: No
Languages: English, Italiano, Македонски, Српски |
Date: 02/07/2009 08:33 Re: Help | #post20978 | Why you're not using the MemHT db connection? |
|
 |
| |
slashado Donator
Posts: 282

Gender:  Online: No
Version: 4.0.1 Country: Brasil Languages: Português, Inglês (via Google), e todas as outras (via google) |
Date: 02/07/2009 08:58 Re: Help | #post20979 |
Why I did not know how, I do not understand law, studying other modules, as is done by connecting the MemHT.
I tried in all ways possible, tried to include the code overall dblink not working.
and the table is inside the db of memht and all other modules and blocks.
I do not know what I'm missing that part, what do I do?
I do not understand almost nothing of PHP + MySQL is with MemHT that finally I like the subject. |
|
 |
| |
mem MemHT's Dad Admin & Developer

Posts: 6824

Gender:  Online: No
Languages: English, Italiano, Македонски, Српски |
Date: 02/07/2009 10:30 Re: Help | #post20982 | I can't understand you people... read the damned wiki (i spent a lot of time writing it), the use of the db is explained very well, with practical examples
http://memht.com/wiki/Scripting_Guidelines#Database_communication
| code | global $dblink;
$row = $dblink->get_row("SELECT value FROM table WHERE id='$id'");
$name = $row['value']; |
Edited: 02/07/2009 10:31 |
|
 |
| |
komsija Senior Member
Posts: 102

Gender:  Online: No
Languages: Serbian and English |
Date: 02/07/2009 12:00 Re: Help | #post20988 | i would like to put this slideshow insted of header ...can i do thet???
some kind of code thet will puul over this slide show to header ????
is thet posible?
insted of template_header.gif komsija |
|
 |
| |
mem MemHT's Dad Admin & Developer

Posts: 6824

Gender:  Online: No
Languages: English, Italiano, Македонски, Српски |
Date: 02/07/2009 12:12 Re: Help | #post20989 | Template file:
templates/xxx/home.html |
|
 |
| |
komsija Senior Member
Posts: 102

Gender:  Online: No
Languages: Serbian and English |
Date: 02/07/2009 12:15 Re: Help | #post20990 | ok
thx, but i am not a coder..just a nubie....so anywone, do you know what code i should put there and where, and what modification i should do....sorry i know i am asking too much  komsija |
|
 |
| |
komsija Senior Member
Posts: 102

Gender:  Online: No
Languages: Serbian and English |
Date: 02/07/2009 12:59 Re: Help | #post20996 | umesto
<tr>
<td class="tpl_header" colspan="3" align="right"><div style="padding-right:12px;"><?php showBanner(1); ?></div></td>
</tr>
u home.html........sta treba da stavim?? komsija |
|
 |
| |
komsija Senior Member
Posts: 102

Gender:  Online: No
Languages: Serbian and English |
Date: 02/07/2009 13:01 Re: Help | #post20997 | i ima jos jedan deo
<!-- HEADER e -->
<!-- MAIN i -->
<tr>
<td class="tpl_main_l"></td>
<td class="tpl_content">
<!-- content -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
{if condition="$fullscreen < 2"}
<td class="tpl_navigator" valign="top"> komsija |
|
 |
| |