Jump to content

PTW

New Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

PTW's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This code is now generating the default image but doesn't get the image I'm trying to get. <?php if ($entry[1] == $field = xprofile_get_field_data(2, $user_id)); { echo get_avatar($field); } ?>
  2. Ok, tried that but got no result if I just use that. But this gave me a clue on the way. In you code you wrote $field but I want to get the specific field $field = xprofile_get_field_data(2, $user_id); Like I wrote above. So something like this: (even if this not work yet) <?php if ($entry[1] == $field = xprofile_get_field_data(2, $user_id)) { echo get_avatar(); } ?>
  3. This is working code that gets the data from a field that registered users have to fill out in their profiles in wordpress: <?php $field = xprofile_get_field_data(2, $user_id); echo '<span class="wisfb_carNumber">' . $field . '<span>'; ?> This is the code that generates data from a Excel-file: <?php $data = wp_excel_cms_get("EXCEL-DOCUMENT"); ?> <?php foreach($data as $entry): ?> <?php echo $entry[1]; ?> <?php endforeach; ?> Now I want to do this: If the number witch is generated in: <?php echo $entry[1]; ?> is the same number as in the users: $field = xprofile_get_field_data(2, $user_id); get this users avatar: echo get_avatar(); Does anyone have an idea on how to do this?
  4. ok, don't really get this, but here is what get echo:d if(mysql_num_rows($res) != 0): while($row = mysql_fetch_assoc($res)) { echo '<div class="title"><h1><a href="index.php?id=' . $row['id'] . '">' . $row['title'] . '</a></h1></div>'; echo '<div class="date"><p>' . $row['date'] . '</p></div>'; echo '<div class="photo"><p>' . $row['photo'] . '</p></div>'; echo '<div class="txt"><p>' . $row['body'] . '</p></div>'; } I got to get the $_FILES array in -> echo '<div class="photo"><p>' . $row['photo'] . '</p></div>'; somehow?
  5. hello world! First post here! I'm a newbie trying to make my own cms, everything is working except the import of image into the post, this becomes text. Here is the code: function connect() { $con = mysql_connect($this->host, $this->username, $this->password) or die (mysql_error()); mysql_select_db ($this->db, $con) or die (mysql_error()); } function get_content($id = '') { if($id != ""): $id = mysql_real_escape_string($id); $sql = "SELECT * FROM cms_content WHERE id = '$id'"; else: $sql = "SELECT * FROM cms_content ORDER BY id DESC"; endif; $return = '<a href="index.php">go back</a>'; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) != 0): while($row = mysql_fetch_assoc($res)) { echo '<div class="title"><h1><a href="index.php?id=' . $row['id'] . '">' . $row['title'] . '</a></h1></div>'; echo '<div class="date"><p>' . $row['date'] . '</p></div>'; echo '<div class="photo"><p>' . $row['photo'] . '</p></div>'; echo '<div class="txt"><p>' . $row['body'] . '</p></div>'; } else: echo '<p class="results_">uH oh!</p>'; endif; echo $return; } function add_content($p) { $title = mysql_real_escape_string($p['title']); $date = mysql_real_escape_string($p['date']); $photo = mysql_real_escape_string($p['photo']); $body = mysql_real_escape_string($p['body']); // if they write wrong if(!$title | | !$body): if(!$title): echo "<p>The Title is Required</p>"; endif; if(!$photo): echo "<p>No photo</p>"; endif; if(!$body): echo "<p>The body is Required</p>"; endif; echo '<p><a href="add-content.php">Try again</a></p>'; else: // add to db $sql = "INSERT INTO cms_content VALUES (null, '$title', '$date', '$photo', '$body')"; $res = mysql_query($sql) or die(mysql_error()); echo "<p class='results_'>Added with success!</p>"; // [END] add to db endif; // [END] if they write wrong } and in the html i got a form <form enctype="multipart/form-data" method="post" action="index.php"> <input type="hidden" name="add" value="true"> <div> <label for="title"><p>Title:</p></label> <input type="text" name="title" id="title" /> </div> <div> <input type="file" name="photo"><br> </div> <div> <label for="body"><p>Body:</p></label> <textarea name="body" id="body" rows="8" cols="40"></textarea> </div> <input type="submit" name="submit" value="Add Content"> </form>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.