Reputation Activity
-
abeer reacted to rbrtsmith in html5 problemYou might find the HTML5 drag and drop API better for this kind of thing.
Here's a work in progress where I am using it http://wasabiadmin.se/eflag you can drag the items in the table to the nav on the left sidebar. With this there is no need for canvas, just regular HTML elements.
-
abeer reacted to teodora in facing problems ON SUCCESS MESSAGEMaybe you can try showing the message on successful form submit? - http://api.jquery.com/submit/
-
abeer reacted to junior in pop up modal or html from the bottomHey Abeer,
Look into the jQuery Animate http://api.jquery.com/animate/
With this you can start with the box off the screen at the bottom and then have it animate into the centre of the screen from there.
Something like
$(".popup").animate({top: "300px"}, 750)
-
abeer reacted to Chris Day in passing textfiled data by selecting checkboxYou can use javascript to do that
something like this http://jsfiddle.net/pG66K/1/
Or you could do this via PHP use the same sort of HTML as i posted above with radio buttons
$name = $_POST['name'.$_POST['abeer']]; -
abeer reacted to Chris Day in passing textfiled data by selecting checkboxChange the checkbox to a radio like so
<html> <body> <form action="new.php" method="post"> <table width="582" height="149"> <tr> <td width="68"> <label> <input type="radio" name="abeer" id="abeer" value="1"> </label> </td> <td width="502"> <label> <input type="text" name="name1" id="abeerf1"> </label> </td> </tr> <tr> <td> <label> <input type="radio" name="abeer" id="abeer" value="2"> </label> </td> <td> <label> <input type="text" name="name2" id="abeerf2"> </label> </td> </tr> </table> <input type="submit"> </form> </body> </html>Then in your php code use something like this
$name = ($_POST['abeer'] == 1?$_POST['name1']:$_POST['name2']);
If you want me to explain anything just ask
-
abeer reacted to mteam in problem in ie 7/8Works in ie8 for me in ie7 remove comma end of line 9 in vt.js
-
abeer reacted to GalaxyTramp in pagination problemsHi
You need to add an id to your pagination. Try this:
<?php mysql_connect('mysql2', 'pegu', 'segu') or die('Connection Failed'); mysql_select_db('legu') or die('Database not found'); $iDefaultRecord = 1; $id = isset($_GET['id']) ? filter_var($_GET['id'], FILTER_VALIDATE_INT) : $iDefaultRecord; $result = mysql_query("SELECT title, dtl, meta_d, meta_k FROM page WHERE id=$id"); if (!mysql_num_rows($result)) { header('Location: 404.php', true, 404); die();}$row = mysql_fetch_array($result);$title = stripslashes($row['title']);$dtl = stripslashes($row['dtl']);$meta_d = stripslashes($row['meta_d']);$meta_k = stripslashes($row['meta_k']); $pages = explode("{newpage}", $dtl); if(isset($_GET['page']) && $_GET['page'] > 0) { $current_page = $_GET['page']; if($current_page > count($pages)) { $current_page = count($pages); } } else { $current_page = 1; } $description = $pages[$current_page - 1]; $navigation = "Pages: "; for ($i = 1; $i <= count($pages); $i++) { if($i == $current_page) { $navigation .= "<b>"; } $navigation .= "<a href='?page=" . $i . "&id=" . $id . "'> " . $i . "</a> "; if($i == $current_page) { $navigation .= "</b>"; } } ?>
-
abeer reacted to mteam in browser problemLooks like an error in the script in the columnizer script try changing this line 56
jQuery(this).css({cssFloat:'left', width:''+col_Width+'px'});
to
jQuery(this).css({float:'left', width:''+col_Width+'px'});
-
abeer reacted to markeh in long article paginationYour still only echoing out the $dtl in your code
<h3>below content will come from database</h3> <?php echo $dtl; ?>
Instead you need to echo out the page which is selected
<h3>below content will come from database</h3> <div><?php echo $description; ?></div> <div><?php echo $navigation; ?></div>
In the long run though Jocks solution is what you should be aiming for.
-
abeer reacted to markeh in long article paginationAdding some markup in the text makes it much easier to split it up, best way of doing it in my view.
<?php // Your bit of code mysql_connect('localhost', 'ash', 'lash') or die('Connection Failed'); mysql_select_db('lash') or die('Database not found'); $iDefaultRecord = 1; $id = isset($_GET['id']) ? filter_var($_GET['id'], FILTER_VALIDATE_INT) : $iDefaultRecord; $result = mysql_query("SELECT title, dtl, meta_description, meta_keywords FROM page WHERE id=$id"); if (!mysql_num_rows($result)) { header('Location: 404.php', true, 404); die(); } $row = mysql_fetch_array($result); $title = stripslashes($row['title']); $dtl = stripslashes($row['dtl']); $meta_desc = stripslashes($row['meta_description']); $meta_keys = stripslashes($row['meta_keywords']); // Then do an explode on the $dtl from your database query $pages = explode("{newpage}", $dtl); // Set which page is currently selected, by default set page 1 if(isset($_GET['page']) && $_GET['page'] > 0) { $current_page = $_GET['page']; // If the page number is higher than the last page, set it to the last page // You could change this to show an error instead, maybe a 404 if($current_page > count($pages)) { $current_page = count($pages); } } else { $current_page = 1; } // Get the page which is selected, the index starts at 0 so -1 from the page number (page1 is index0) $description = $pages[$current_page - 1]; // Setup navigation to show all the pages, and make the currnet page bold $navigation = "Pages: "; for ($i = 1; $i <= count($pages); $i++) { if($i == $current_page) { $navigation .= "<b>"; } $navigation .= "<a href='?page=" . $i . "'> " . $i . "</a> "; if($i == $current_page) { $navigation .= "</b>"; } } ?> <html> <head> <meta name="description" content="<?php echo $meta_description; ?>" /> <meta name="keywords" content="<?php echo $meta_keywords; ?>" /> <title>MySite.com - <?php echo $title; ?></title> </head> <body> <h1><?php echo $title; ?></h1> <p><?php echo $description; // Will display the current page ?></p> <p><?php echo $navigation; // Will display the list of page numbers?></p> </body> </html>
Not sure how familiar you are with php, but I would have made it object orientated (if I was to use it), but this should give you a simple overview of how it all works. If you would like it to be made object orientated, I'd be more than happy too. If your still learning, maybe best how it is now.
-
abeer reacted to markeh in long article paginationHopefully it should work on the live server.
It's not the easiest thing to explain, but what it does do is orgainse your code in a much cleaner way, so if several different pages needed to have pagination, it would be easy to use it again and again without having to write much code. Think of Object Oriented programming as creating lots of little programs within your main program. So you have one program which handles connecting to a database, another which handles splitting some text into pages, since at the moment in that file above which you have its all lumped together.
http://www.killerphp.com/tutorials/object-oriented-php/ Watching the why learn object oriented will explain in more detail why, and the rest of the videos should get you started, if your keen to learn more about it and have a bit of free time.
Feel free to +1 if it helps
-
abeer reacted to webdeveloper93 in paginationHeres a simple class i made for my blog that shows pagination
class paginate{ /**Our private variables**/ private $_query = ''; private $_count = ''; private $_pages = ''; private $_current = ''; private $page = ''; private $next = ''; private $prev = ''; private $link = ''; /**Our public variables**/ public $limit; public $limit_start = ''; public $limit_end = ''; /** * paginate::__construct() * * @param integer $set_limit * @return void */ public function __construct($set_limit){ /**Set up our variables that needs to be called at the start of this script**/ $this->limit = $set_limit; $this->page = (!isset($_GET['page']) || $_GET['page'] < 0) ? "1" : $_GET['page']; $this->page = ceil($this->page); $this->limit_start = $this->limit; $this->limit_end = $this->page*$this->limit-($this->limit); } /** * paginate::paginate_me() * * @param mixed $current_page * @param mixed $query * @return */ public function paginate_me($current_page,$query){ $this->_query = sb_mysql()->SB_query($query); $this->count = sb_mysql()->SB_num_rows($this->_query); $this->_pages = ceil($this->count/$this->limit); $this->_current = $current_page; $this->next = ($this->page+1 > $this->_pages) ? "Next" : "<a href='".$this->_current.".php?page=".($this->page+1)."'>Next</a>"; $this->prev = ($this->page-1 <= 0) ? "Prev" : "<a href='".$this->_current.".php?page=".($this->page-1)."'>Prev</a>"; /**Echo out the prev link**/ echo "<div class='pagination'>"; echo $this->prev; for($i = 1; $i<=$this->_pages;$i++){ $this->link = ($this->page == $i) ? " ".$i." " : "<a href='".$this->_current.".php?page=".$i."'>$i</a>"; echo $this->link; } echo $this->next; echo "</div>";/**End pagination div**/ } } /**Change 15 to the number of results u want per page**/ $pag = new paginate(15);
-
abeer reacted to MatthehCarter in Is this possible?Okay, so if we take the query that you were using:
$result = mysql_query("SELECT *FROM page WHERE id='1'")
The $result of this query is only ever going to be the row in your table where the ID is equal to 1. Which means that we can't select any other data from this query, as it hasn't been fetched. So by replacing the number 1 with a variable, we are then able to select different row IDs depending upon which page is requested.
So
$result = mysql_query("SELECT *FROM page WHERE id='1'")
Will only ever fetch one result from the table, the one where "ID" is equal to 1
Whereas if we use the following code:
$result = mysql_query("SELECT *FROM page WHERE id='$id'")
We can then give the $id a different value depending on which page is requested, so say they go to http://yourdomain.com/?pageid=1
We would then use the following code:
$id = $_GET['pageid'];
So when, pageid=1 the variable will equal one, so the row where the ID is equal to one is fetched. When pageid=2 the variable now has a value of 2 and so on
hopefully that helped, sorry I'm bad at explaining things haha
-
abeer reacted to MatthehCarter in Is this possible?Instead of using the ID, why not use the name of the page? So they will go to the following URL:
http://yourdomain.com/?page=Kate'>http://yourdomain.com/?page=Kate
You will them grab the variable "kate"
if(isset($_GET['page'])) { $page = strip_tags($_GET['page']); }
From here, you then use the following MySQL query
mysql_query("SELECT * FROM `page` WHERE `page_name`='$page'");
This will then select the page based upon their name instead of their ID.
You could also choose their ID if you wish, but that's more unsecure as it gives people an idea of what is in your DB, how many rows etc. and these are parts that people need to know for SQL injection.
Basically, you should never use a static number "WHERE `id`='1'" instead you should use variables as they can change, "WHERE `id`='$id'" hope this helps!
Edit:
Oh, and you could also use the following htaccess code:
RewriteEngine on RewriteRule ^page/([^/\.]+)/?$ index.php?page=$1 [L]
This means that they would go to:
http://yourdomain.com/page/Kate
instead of
http://yourdomain.com/?page=Kate
contact me if you need any more help
-
abeer reacted to zed in Is this possible?http://www.sebastiansulinski.co.uk/tutorials/show_item/55/php_url_parameter_and_page_include -
abeer reacted to zed in Is this possible?you've asked this before? Just have one page, add a parameter to pass/accept the ID and then do you sql based on that parameter.
-
abeer reacted to timp in How can i do this?add the following line to the PHP part after the mysql SELECT... line and tell us what it says
echo var_dump($result);
-
abeer reacted to timp in How can i do this?Try as zed said
$result = mysql_query("SELECT * from page WHERE id = 3");
or
$result = mysql_query("SELECT * from 'page' WHERE id = 3");
-
abeer reacted to zed in How can i do this?not in quotes
-
abeer reacted to Geeks in How can i do this?if(isset($_POST['id']) {
should be :
if(isset($_POST['id'])) {
there is a ) missing
-
abeer reacted to zed in How can i do this?$mysql->query("UPDATE 'table_name' <---- put your table name
-
abeer reacted to timp in How can i do this?Hey abeer,
you will need a html file with the form in it and a script that fills the page and processes your changes. This could look like this:
Example.htm:
<?php $mysql = new mysqli($db_host, $db_user, $db_pw, $db); if(isset($_POST['id']) { $mysql->query("UPDATE 'table_name' SET content='".$_POST['content']."' WHERE id = ".$_POST['id']); } $result = $mysql->query("SELECT * from 'table_name' WHERE id = 'specific id'"); $data = $mysql->fetch_assoc(); $id = $data['id']; $content = $data['content']; ?> <html> <head>...</head> <body> <form name="change_content" method="POST" action="Example.htm"> <input type="hidden" name="id" value="<?php $id ?>"> <input type="text" name="content" value="<?php $content ?>"> <input type="submit" value="change"> </form> </body> </html>
The code is not safe this way. You will have to escape the data the user can enter if you want many users to use the script due to mysql-injection.
Tim
-
abeer reacted to Blofeld in data not displaying from databaseThe one with the while() statement I posted should have worked. I didn't look through your DB images to see what table 'dtl' was on. Just assumed you would replace that with the result you were after. So, if you want to return all of the results, you can still use the while() statement and limit them in your sql query using LIMIT
-
abeer reacted to MatthehCarter in data not displaying from databaseSELECT * FROM `content` WHERE `id`='3' < the "WHERE ID ='3'" selects the row which has the ID of 3. You could also use it to select certain titles: WHERE `title`='Hello' and so on
-
abeer reacted to Blofeld in data not displaying from databaseThat isn't enough to show anything. You need to fetch the info and echo it the way you want it.
e.g.
<?php mysql_connect("localhost", "dhaka", "dhaka") or die("Connection Failed"); mysql_select_db("dhaka")or die("Connection Failed"); $query = "SELECT * FROM dhaka"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){ echo $row['dtl'] . "<br />"; }